This issue is fixed in Donut but the source code available in the open is not the latest version.
2009/8/24 Justin <chih.ting....@gmail.com>: > > This issue still happened in Donut. > > I want to describe my structure first. There are two main view in my > Activity, one is Gallery another is a FrameLayout, I named it > FullSizeViewer which can show fit-to-screen photo. When tapping a > photo in Gallery, the screen changes to FullSizeViewer. FullSizeViewer > adds and removes from PhoneWindow dynamically. > The Gallery and FullSizeViewer load photo from SD card dynamically > (Loading and decoding in the other thread, and posted bitmap back to > main thread). > > I found there is a member variable called 'mRealFocusedView' in > ViewRoot which sets to a wrong view (the view doesn't detach to any > parent) when this exception occurs and ViewRoot uses this wrong view > to calculating scroll distance and drawing rectangle. > > In my case, when tapping a photo in Gallery and enter in > FullSizeViewer, the mRealFocusedView of ViewRoot is correct basically. > Sometimes the mRealFocusedView of ViewRoot is the Gallery's child > view. At this moment, this issue occurs. > > I tried to set visibility of Gallery's child view to GONE and it is > not help because the 'mRealFocusedView' of ViewRoot still not correct > view. > I also tried to not dynamically add or remove FullSizeViewer, but this > issue still happened. > > The only way to solve this issue is use two Activities, one Activity > contains Gallery, and another contains FullSizeViewer. > But it is too slow when activity change and the screen will become > black for a while. > It is not acceptable for me. Besides, I need to do some transition > animation when changing from Gallery to FullSizeViewer. > If I use two Activities, the animation can not be implemented. > > I have tried to clear 'mRealFocusedView' to null by calling the > 'clearChildFocus' of decoreView before the moment of exception > happened. > It only can reduce the probability of this issue but it can't really > fix this issue. > > There are three situations easily to reproduce this issue. > 1. Device is busy. > 2. When tapping photo in Gallery, keep using track ball to scroll the > Gallery. > 3. When you scroll or re-layout the Gallery, press Google search key > and then press back immediately. > > Is there any solution or work-around to prevent this issue happen? > > Here are my logs: > > 08-21 09:43:31.583 W/dalvikvm( 863): threadid=3: thread exiting with > uncaught exception (group=0x4001db88) > 08-21 09:43:31.583 E/AndroidRuntime( 863): Uncaught handler: thread > main exiting due to uncaught exception > 08-21 09:43:31.693 E/AndroidRuntime( 863): > java.lang.IllegalArgumentException: parameter must be a descendant of > this view > 08-21 09:43:31.693 E/AndroidRuntime( 863): at > android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java: > 2519) > 08-21 09:43:31.693 E/AndroidRuntime( 863): at > android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java: > 2456) > 08-21 09:43:31.693 E/AndroidRuntime( 863): at > android.view.ViewRoot.scrollToRectOrFocus(ViewRoot.java:1554) > 08-21 09:43:31.693 E/AndroidRuntime( 863): at > android.view.ViewRoot.draw(ViewRoot.java:1291) > 08-21 09:43:31.693 E/AndroidRuntime( 863): at > android.view.ViewRoot.performTraversals(ViewRoot.java:1174) > 08-21 09:43:31.693 E/AndroidRuntime( 863): at > android.view.ViewRoot.handleMessage(ViewRoot.java:1769) > 08-21 09:43:31.693 E/AndroidRuntime( 863): at > android.os.Handler.dispatchMessage(Handler.java:99) > 08-21 09:43:31.693 E/AndroidRuntime( 863): at > android.os.Looper.loop(Looper.java:123) > 08-21 09:43:31.693 E/AndroidRuntime( 863): at > android.app.ActivityThread.main(ActivityThread.java:4203) > 08-21 09:43:31.693 E/AndroidRuntime( 863): at > java.lang.reflect.Method.invokeNative(Native Method) > 08-21 09:43:31.693 E/AndroidRuntime( 863): at > java.lang.reflect.Method.invoke(Method.java:521) > 08-21 09:43:31.693 E/AndroidRuntime( 863): at > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run > (ZygoteInit.java:791) > 08-21 09:43:31.693 E/AndroidRuntime( 863): at > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) > 08-21 09:43:31.693 E/AndroidRuntime( 863): at > dalvik.system.NativeStart.main(Native Method) > > > On 8月20日, 上午1時15分, "Yusuf Saib (T-Mobile USA)" <yusuf.s...@t- > Mobile.com> wrote: >> Or you could git donut. >> >> ___ >> .-" "-. >> .' . ; `. >> / : . ' : \ >> | ` .-. . ' | >> | : ( ) ; ` | >> | : `-' : | >> \ .` ; : / >> `. . ' .' >> `-.___.-' >> >> Yusuf Saib >> Android >> ·T· · ·Mobile· stick together >> The views, opinions and statements in this email are those of the >> author solely in their individual capacity, and do not necessarily >> represent those of T-Mobile USA, Inc. >> >> On Aug 19, 6:06 am, Moxor <maxcambi...@gmail.com> wrote: >> >> >> >> > Thanks. I'll have to wait then :( >> >> > On 4 ago, 17:52, Romain Guy <romain...@google.com> wrote: >> >> > > Known bug it's been fixed in Donut >> >> > > On Tue, Aug 4, 2009 at 1:48 PM, Moxor<maxcambi...@gmail.com> wrote: >> >> > > > Hi, >> > > > Did you manage to solve it? I have a similar problem. >> > > > Every time I change the focus to a button, and then touch another >> > > > button (I call setContentView()), the application crash with this >> > > > Logcat: >> >> > > > 08-04 17:12:00.251: ERROR/AndroidRuntime(880): Uncaught handler: >> > > > thread main exiting due to uncaught exception >> > > > 08-04 17:12:00.292: ERROR/AndroidRuntime(880): >> > > > java.lang.IllegalArgumentException: parameter must be a descendant of >> > > > this view >> > > > 08-04 17:12:00.292: ERROR/AndroidRuntime(880): at >> > > > android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java: >> > > > 2454) >> > > > 08-04 17:12:00.292: ERROR/AndroidRuntime(880): at >> > > > android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java: >> > > > 2391) >> > > > 08-04 17:12:00.292: ERROR/AndroidRuntime(880): at >> > > > android.view.ViewRoot.scrollToRectOrFocus(ViewRoot.java:1301) >> > > > 08-04 17:12:00.292: ERROR/AndroidRuntime(880): at >> > > > android.view.ViewRoot.draw(ViewRoot.java:1107) >> > > > 08-04 17:12:00.292: ERROR/AndroidRuntime(880): at >> > > > android.view.ViewRoot.performTraversals(ViewRoot.java:1030) >> > > > 08-04 17:12:00.292: ERROR/AndroidRuntime(880): at >> > > > android.view.ViewRoot.handleMessage(ViewRoot.java:1482) >> > > > 08-04 17:12:00.292: ERROR/AndroidRuntime(880): at >> > > > android.os.Handler.dispatchMessage(Handler.java:99) >> > > > 08-04 17:12:00.292: ERROR/AndroidRuntime(880): at >> > > > android.os.Looper.loop(Looper.java:123) >> > > > 08-04 17:12:00.292: ERROR/AndroidRuntime(880): at >> > > > android.app.ActivityThread.main(ActivityThread.java:3948) >> > > > 08-04 17:12:00.292: ERROR/AndroidRuntime(880): at >> > > > java.lang.reflect.Method.invokeNative(Native Method) >> > > > 08-04 17:12:00.292: ERROR/AndroidRuntime(880): at >> > > > java.lang.reflect.Method.invoke(Method.java:521) >> > > > 08-04 17:12:00.292: ERROR/AndroidRuntime(880): at >> > > > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run >> > > > (ZygoteInit.java:782) >> > > > 08-04 17:12:00.292: ERROR/AndroidRuntime(880): at >> > > > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) >> > > > 08-04 17:12:00.292: ERROR/AndroidRuntime(880): at >> > > > dalvik.system.NativeStart.main(Native Method) >> >> > > > This happens outside my code, once the onClick event is finished. >> >> > > > Thanks in advance. >> > > > Max >> >> > > -- >> > > Romain Guy >> > > Android framework engineer >> > > romain...@android.com >> >> > > Note: please don't send private questions to me, as I don't have time >> > > to provide private support. All such questions should be posted on >> > > public forums, where I and others can see and answer them- 隱藏被引用文字 - >> >> - 顯示被引用文字 - > > > -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---