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. MediaPlayer.start() doesnot work fine after calling MediaPlayer.seekTo(0)

Hi,

I have a requirement to play several sounds many times in my game so
instead of creating the MediaPlayer again and again I have called
mp.seekTo(0) in onCompletion(mp) so that it will restart.
Sometimes the sound is not audible from the device when I call mp.start
() after setting mp.seekTo(0); but the player calls onCompletion()
without playing any sound, this is observed randomly on most of the
sounds

FYI:

  -  My sounds are of short duration mostly less than a second.
  -  I am using a separate MediaPlayer for each sound (as I need this)
  -  There are almost 28 sounds in my game so i will be creating 28
MediaPlayers.
  -  Below is the attached code for player

Also If I try to play many sounds one after the other in a short
period of time i get an error saying "no more track names available".
can u tell Why this is happening...?


check the below code:

public boolean isPlayingSound; //class member
MediaPlayer mp = null;
String last_req = "";
public void playSound(final String res) {
        if (isPlayingSound){
                return;
        }
        try {

                if (last_req.equals(res))
                {
                        System.out.println("starting again................: 
"+res); //
Sudhaker
                        mp.start();
                        isPlayingSound = true;
                        return;
                }
                last_req = res;
                mp = new MediaPlayer();

                FileInputStream fIn = Utils.getContext().openFileInput(res);
                if (fIn != null)
                {
                        //we tell the mediaplayer which file he needs to play. 
notice we
don't tell him if this is a MIDI, WAV, MP3 or even AVI for that
matter.
                        //why? he is smart enough to recognize them!! we don't 
even have to
use valid extensions like say .mid, .mp3, .wav!!! ... WOAH!! =D
                        mp.setDataSource(fIn.getFD());
                        fIn.close();
                }

                mp.setOnPreparedListener(new
                MediaPlayer.OnPreparedListener() {
                        public void onPrepared(MediaPlayer mp)
                        {
                                mp.start();
                                isPlayingSound = true;
                        }
                });

                mp.setOnCompletionListener(new
                MediaPlayer.OnCompletionListener() {
                        public void onCompletion(MediaPlayer mp)
                        {
                                System.out.println("sound playing finished : 
"+res + " and seek to
start"); //Sudhaker
                                //mp.release();
                                mp.seekTo(0);
                                isPlayingSound = false;
                        }
                });

                mp.setOnErrorListener(new
                MediaPlayer.OnErrorListener() {
                        public boolean onError(MediaPlayer mp, int what, int 
extra)
                        {
                                mp.release();
                                mp = null;
                                deleteSoundFile(res);
                                isPlayingSound = false;
                                last_req="";
                                return false;
                        }
                });

                // mp.prepareAsync();
                if (isLooping())
                {
                        mp.setLooping(true);
                }
                mp.prepare();

        } catch (Exception e) {
                mp.release();
                deleteSoundFile(res);
                isPlayingSound = false;
                mp = null;
                new PlayerImpl(fileName,fileInputStream);
                last_req="";
                playSound(fileName);
        }
}


please reply asap...

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

2. Media recorder and camera device

I am trying to make use of the setCamera method with the mediareorder.
I have created and opened a new camera device however every reference
to it via setcamera results in an error about trying to access a
locked camera device.

There are no other open camera devices to the best of my knowledge.

Any ideas would be appreciated

Bratag
--~--~---------~--~----~------------~-------~--~----~

3. IM app is not openining

4. Query on HID support on latest google release

5. How to detect whether the virtual keyboard is visible or not? SDK 1.5

6. Is Android clock, which is in the destop, a widget or application (Activity)?

7. Is Android clock, which is in the destop, a widget or application (Activity)?