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. XMPP service, Jabber

I am currently working on a project which requires a server to request
data from the devices which are currently connected to the server.
Meaning, first the server finds out which devices are connected to the
server and then sends an application specific message to the client
device which should wake certain functionality present on the client,
like for example send out its current location.

I was looking into XMPP service which looked promising since it works
as a PUSH notification. The <presence> in XMPP can be used to check if
the device is currently connected and has subscribed to the server.
Since every android user has a gmail account, I was thinking of using
the gmail xmpp service to connect /subscribe to the server. Then send
specific message to the client, i.e But if a message is
sent this way the client app gets the message as well as the native
gtalk client. So how do I go about intercepting this so that it
doesn't show up on the gtalk client but my app still gets it.

I want the PUSH notification to work, not PUSH.

Please do comment on the above approach. If there is another way to do
this, please do suggest.



2. REG: CSS style sheets

Can we import the CSS style sheets in to our android application.


3. increase the swipe more sensitive

4. Kenangan masa kecil

5. Emulator error : No space left on device

6. Some MapView mysteries

7. How to solve the problem of launch the apps twice or more?