The specified child already has a parent. You must call removeView() on the child's parent first.

by Dikers » Fri, 14 Nov 2008 09:50:19 GMT

Sponsored Links
 I want to start 'MultiActivity' from 'OtherActivity' that in another
and when I back to homescreen (don't close 'MultiActivity' ),  start
'MultiActivity' again,
need to save the state of 'MultiActivity'.

but when running in
         backLayout.updateViewLayout(backgroundView, blp);

Something has gone wrong.

java.lang.IllegalStateException: The specified child already has a
parent. You must call removeView() on the child's parent first.

   at android.view.ViewGroup.addViewInner( )
   at android.view.ViewGroup.addView(

Does anyone know what's wrong with this app,
Thanks in advance!


private static AbsoluteLayout backLayout  = null;
private static ImageView backgroundView = null;

public void onCreate(Bundle icicle){


        LayoutParams blp = new AbsoluteLayout.LayoutParams( 200, 300,  0, 0);


                backgroundView =  new ImageView(this);

                backLayout = new AbsoluteLayout(this);
                backLayout.addView(backgroundView,  blp);

        }else {

                backLayout.updateViewLayout(backgroundView, blp);
                setContentView(backLayout);// occur exception.


                Intent intent = getIntent();
                if( intent.hasExtra("data")){
                        String data = intent.getStringExtra("data");


 <activity android:name=".MultiActivity" android:theme="@android:style/
Theme.Dialog"  android:label="@string/app_name">

                <action android:name="android.intent.action.VIEW" />
android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="
vnd.dikers.test" />


---------------------OtherActivity.class  in another
        Intent intent = new Intent();

        intent = new Intent(Intent.ACTION_VIEW);
        intent.putExtra("data", "data");

The specified child already has a parent. You must call removeView() on the child's parent first.

by gsmd » Sun, 15 Mar 2009 22:18:04 GMT

 This is the IllegalStateException thrown from onCreate() that brings
the main activity of my app down upon restart (e.g. launch app -> hit
back -> launch again -> got it).
Could someone elaborate on what does this exception mean?

Sponsored Links

Other Threads

1. Do not understand the Android contribution scheme

I'm working with pretty advanced stuff using XML schemas etc.
Such support is not to be found in the current docs.

But in the source rep I found this:;a=tree

My question is:
- Has this been granted as a part of the future Android platform?
- Will this package offer Java bindings?


2. AACPlus - Decoding a Stream? - Anyone Shoutcast?

Hello Androids!

So lets get Radio Streaming working! First to those that are experts.
The G1 phone supports AAC file types... but not sure if AACPlus? or
are we talking about the same thing? Do we need decoder support? Is
there any decoder support on the MediaPlayer?

So I was looking into making an ACCPlus V1 or V2 radio stream readable
by the MediaPlayer but apparently it doesn't work...
if I store a few Kbytes of this stream into a file than try to play it
on my computer it works...  If I try playing that file on my G1
phone... no luck...

So at this point I know I'm getting the right data...

Now how do we decode this stream to be MediaPlayer readable on
android? I guess this will get us on the right path to Radio



3. RingtoneManager URIs

4. What happened to ADC 2?

5. Need to resolve .APK not found error.

6. Best way to build multi page form

7. How to use oprofile on android?