IllegalArgumentException occur: parameter must be a descendant of this view in ViewGroup.java:2454

by Oceanedge » Thu, 02 Jul 2009 08:58:18 GMT


Sponsored Links
 i,
I am using Android SDK 1.5. I am developing an activity with multiple
content views. It will call setContentView() with different viewgroup
instance for different functionality. It contains a text input dialog
popped up by an option menu item. I didn't specify anything for IME in
mainfest.xml & EditText attributes. I found at first, the soft
keyboard for the text input dialog will overlap on the activity
content view. But after several content view switch (by calling
setContentView() with different ViewGroup instance), the soft keyboard
will resize the activity content view.
Why this inconsistent behavior happens?

And some times, the activity is also crashed when soft keyborad is
showing for the test input dialog. Here is the log:
07-01 07:30:18.606: WARN/InputManagerService(726): Window already
focused, ignoring focus gain of:
com.android.internal.view.iinputmethodclient$stub$pr...@43807360
07-01 07:30:19.575: WARN/KeyCharacterMap(941): No keyboard for id 0
07-01 07:30:19.585: WARN/KeyCharacterMap(941): Using default keymap: /
system/usr/keychars/qwerty.kcm.bin
07-01 07:30:21.896: WARN/InputManagerService(726): Window already
focused, ignoring focus gain of:
com.android.internal.view.iinputmethodclient$stub$pr...@4380ead8
07-01 07:30:28.106: DEBUG/AndroidRuntime(941): Shutting down VM
07-01 07:30:28.115: WARN/dalvikvm(941): threadid=3: thread exiting
with uncaught exception (group=0x4000fe70)
07-01 07:30:28.181: ERROR/AndroidRuntime(941): Uncaught handler:
thread main exiting due to uncaught exception
07-01 07:30:28.256: ERROR/AndroidRuntime(941):
java.lang.IllegalArgumentException: parameter must be a descendant of
this view
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java:
2454)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java:
2391)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
android.view.ViewRoot.scrollToRectOrFocus(ViewRoot.java:1301)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
android.view.ViewRoot.draw(ViewRoot.java:1107)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
android.view.ViewRoot.performTraversals(ViewRoot.java:1030)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
android.view.ViewRoot.handleMessage(ViewRoot.java:1482)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
android.os.Handler.dispatchMessage(Handler.java:99)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
android.os.Looper.loop(Looper.java:123)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
android.app.ActivityThread.main(ActivityThread.java:3948)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
java.lang.reflect.Method.invokeNative(Native Method)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
java.lang.reflect.Method.invoke(Method.java:521)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:782)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
dalvik.system.NativeStart.main(Native Method)
07-01 07:30:28.267: INFO/Process(726): Sending signal. PID: 941 SIG: 3
07-01 07:30:28.267: INFO/dalvikvm(941): threadid=7: reacting to signal
3
07-01 07:30:28.386: INFO/dalvikvm(941): Wrote stack tr



IllegalArgumentException occur: parameter must be a descendant of this view in ViewGroup.java:2454

by Oceanedge » Thu, 02 Jul 2009 16:56:09 GMT


 i,
I am using Android SDK 1.5. I am developing an activity with multiple
content views. It will call setContentView() with different viewgroup
instance for different functionality. It contains a text input dialog
popped up by an option menu item. I didn't specify anything for IME in
mainfest.xml & EditText attributes. I found at first, the soft
keyboard for the text input dialog will overlap on the activity
content view. But after several content view switch (by calling
setContentView() with different ViewGroup instance), the soft keyboard
will resize the activity content view.
Why this inconsistent behavior happens?

And some times, the activity is also crashed when soft keyborad is
showing for the test input dialog. Here is the log:
07-01 07:30:18.606: WARN/InputManagerService(726): Window already
focused, ignoring focus gain of:
com.android.internal.view.iinputmethodclient$stub$pr...@43807360
07-01 07:30:19.575: WARN/KeyCharacterMap(941): No keyboard for id 0
07-01 07:30:19.585: WARN/KeyCharacterMap(941): Using default keymap: /
system/usr/keychars/qwerty.kcm.bin
07-01 07:30:21.896: WARN/InputManagerService(726): Window already
focused, ignoring focus gain of:
com.android.internal.view.iinputmethodclient$stub$pr...@4380ead8
07-01 07:30:28.106: DEBUG/AndroidRuntime(941): Shutting down VM
07-01 07:30:28.115: WARN/dalvikvm(941): threadid=3: thread exiting
with uncaught exception (group=0x4000fe70)
07-01 07:30:28.181: ERROR/AndroidRuntime(941): Uncaught handler:
thread main exiting due to uncaught exception
07-01 07:30:28.256: ERROR/AndroidRuntime(941):
java.lang.IllegalArgumentException: parameter must be a descendant of
this view
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java:
2454)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java:
2391)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
android.view.ViewRoot.scrollToRectOrFocus(ViewRoot.java:1301)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
android.view.ViewRoot.draw(ViewRoot.java:1107)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
android.view.ViewRoot.performTraversals(ViewRoot.java:1030)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
android.view.ViewRoot.handleMessage(ViewRoot.java:1482)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
android.os.Handler.dispatchMessage(Handler.java:99)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
android.os.Looper.loop(Looper.java:123)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
android.app.ActivityThread.main(ActivityThread.java:3948)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
java.lang.reflect.Method.invokeNative(Native Method)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
java.lang.reflect.Method.invoke(Method.java:521)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:782)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
07-01 07:30:28.256: ERROR/AndroidRuntime(941): at
dalvik.system.NativeStart.main(Native Method)
07-01 07:30:28.267: INFO/Process(726): Sending signal. PID: 941 SIG: 3
07-01 07:30:28.267: INFO/dalvikvm(941): threadid=7: reacting to signal
3
07-01 07:30:28.386: INFO/dalvikvm(941): Wrote stack tr


Sponsored Links


IllegalArgumentException occur: parameter must be a descendant of this view in ViewGroup.java:2454

by Moxor » Wed, 05 Aug 2009 04:48:33 GMT


 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
--~--~---------~--~----~------------~-------~--~----~



IllegalArgumentException occur: parameter must be a descendant of this view in ViewGroup.java:2454

by Moxor » Wed, 19 Aug 2009 21:07:02 GMT


 Thanks. I'll have to wait then :(





--~--~---------~--~----~------------~-------~--~----~



IllegalArgumentException occur: parameter must be a descendant of this view in ViewGroup.java:2454

by Yusuf Saib (T-Mobile USA) » Thu, 20 Aug 2009 01:15:12 GMT


 r 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:06am, Moxor <maxcambi...@gmail.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



IllegalArgumentException occur: parameter must be a descendant of this view in ViewGroup.java:2454

by Justin » Mon, 24 Aug 2009 15:09:36 GMT


 his 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



IllegalArgumentException occur: parameter must be a descendant of this view in ViewGroup.java:2454

by Justin » Mon, 24 Aug 2009 15:52:56 GMT


 ould you kindly told me which version of Donut will have the solution
of this issue?
When can we download the Donut with the solution of this issue?

On 84 32 Romain Guy <romain...@google.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



IllegalArgumentException occur: parameter must be a descendant of this view in ViewGroup.java:2454

by Steven Yi » Sat, 29 Aug 2009 06:23:26 GMT


 Hello,

I am working on an application and have run into this problem when
switching views with the virtual keyboard up. I looked and found this
email that this a bug that is fixed in Donut, but is there any
workaround for earlier releases since our app is targetting what
everyone is currently using?

Thanks!
steven





--~--~---------~--~----~------------~-------~--~----~



IllegalArgumentException occur: parameter must be a descendant of this view in ViewGroup.java:2454

by Steven Yi » Sat, 29 Aug 2009 06:24:51 GMT


 Hi All,

We are building an app and have run into this problem when the virtual
keypad is up and touch a button that ends up calling setContentView.
We are targetting Cupcake since that is the current OS deployed.  Are
there any workarounds available?

Thanks!
steven





--~--~---------~--~----~------------~-------~--~----~



IllegalArgumentException occur: parameter must be a descendant of this view in ViewGroup.java:2454

by Justin » Tue, 01 Sep 2009 12:11:18 GMT


 o you know which view in your hierarchy cause this issue happened?
Besides, is this your first time called 'setContentView' in activity?
or you want to change the content view (not first time calling
setContentView) in the same activity?

On 88 109 Steven Yi <steve...@gmail.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



IllegalArgumentException occur: parameter must be a descendant of this view in ViewGroup.java:2454

by Steven Yi » Wed, 02 Sep 2009 22:55:43 GMT


 i Justin,

We are changing an activity after already using it the application.
It is not a particular view that does it as we have many different
views and the situation occurs when the virtual keypad is up and we
touch a button that results in a setContentView. The call to
setContentView is withing a runnable sent to a Handler. This app has
had no problems switching views when the virtual keypad is not used.

Thanks!
steven

On Sep 1, 12:10am, Justin <chih.ting....@gmail.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



IllegalArgumentException occur: parameter must be a descendant of this view in ViewGroup.java:2454

by Lucas » Thu, 10 Sep 2009 06:19:52 GMT


 ello,

Do you know the issue ID that this fix has assigned?

Thanks,

Lucas

On Aug 24, 4:12 am, Romain Guy <romain...@google.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Reason for Monkey crash

Hi All,
Please tell me how to analyse monkey log,to find out reason for monkey
stop,when the monkey abruptly stops while injecting events and no
crash is found after that.
Thanks

-- 

2. abort()-ing HttpGet requests in ThreadSafeClientConnManager

Hi,

I have an http client based on multi-threaded model of apache http
components in my App. And I want to achieve spontaneous cancellation
of http get requests from my Android app.

A new executor thread is started for each http request and the Thread
and the HttpGet is saved in a thread safe queue. When abort is
requested (on pressing back on the progress dialog and when starting a
new activity) - another thread is started which goes through the queue
of Threads and HttpGet and attempts to terminate them (code below).

While the HttpGet gets aborted successfully, the Threads go into
'native' state. They only time out giving SocketTimeoutException after
a default interval. The threads end up this way on most cancellations.
Is this something to be expected or I am hitting a bug?

The issue is that And as soon as 2 threads enter this state, all
further executor threads go into wait. Only when either of the 2
blocked threads time out, other executors get a chance (this seems to
be the default behavior of http). I have have tried many different
thing but I am unable to budge the 'stuck' threads.

I think the problem can be easily overcome by increasing the total no
of threads and threads per host -- but I am not sure if this will be a
correct thing to do (because the socket resources will stay occupied
till timeout and there is nothing theoretically that can stop a user
to do infinite cancellations)? Even if this is -- for Android, what
should be the number?

Now I am also doubting if my abort strategy is flawed. Can anyone
please commentor let me know of a fool-proof abort strategy?

- - -

Run method of the abort thread is like:
public void run() {
                        while (!stopQueue.isEmpty()) {
                                final List<Object> stopRequest = 
stopQueue.remove();
                                HttpGet abortRequest = (HttpGet) 
stopRequest.get(0);
                                Thread abortThread = (Thread) 
stopRequest.get(1);

                                // first abort the request
                                if (abortRequest != null && 
!abortRequest.isAborted()) {
                                        abortRequest.abort();
                                        Log.d("Aborting", 
abortRequest.getURI().toString());
                                }

                                // if the thread is still stuck -- interrupt it
                                if (abortThread != null && 
abortThread.isAlive()) {
                                        abortThread.interrupt();
                                        Log.d("Interrupting", 
abortThread.getName());
                                }
                        }
                }

Thanks
Anurag

-- 

3. child activity does not "finish()" correctly

4. Not able to fecth android coomponents repository through avd manager

5. Calling localhost web service from emulator

6. Calling localhost web service from emulator

7. My reasons not to carry a cell phone