Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8989981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:23:43+00:00 2026-06-15T22:23:43+00:00

Possible Duplicate: Call removeView() on the child’s parent first My activity consist of 3

  • 0

Possible Duplicate:
Call removeView() on the child’s parent first

My activity consist of 3 Listview inside 3 corresponding linear layouts.I am getting the “The specified child already has a parent. You must call removeView() on the child’s parent first.” error in it,when I try to toggle among the listview.It is working fine when I go one by other.Kindly help me with a snippet or example to fix on this.Thank you.

My error log is

12-14 15:32:50.017: E/AndroidRuntime(5102): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
12-14 15:32:50.017: E/AndroidRuntime(5102):     at android.view.ViewGroup.addViewInner(ViewGroup.java:1976)
12-14 15:32:50.017: E/AndroidRuntime(5102):     at android.view.ViewGroup.addView(ViewGroup.java:1871)
12-14 15:32:50.017: E/AndroidRuntime(5102):     at android.view.ViewGroup.addView(ViewGroup.java:1828)
12-14 15:32:50.017: E/AndroidRuntime(5102):     at android.view.ViewGroup.addView(ViewGroup.java:1808)
12-14 15:32:50.017: E/AndroidRuntime(5102):     at com.kk.World.TheWorld.getView(TheWorld.java:629)
12-14 15:32:50.017: E/AndroidRuntime(5102):     at com.kk.World.TheWorld.onClick(TheWorld.java:428)
12-14 15:32:50.017: E/AndroidRuntime(5102):     at android.view.View.performClick(View.java:2538)
12-14 15:32:50.017: E/AndroidRuntime(5102):     at android.view.View$PerformClick.run(View.java:9152)
12-14 15:32:50.017: E/AndroidRuntime(5102):     at android.os.Handler.handleCallback(Handler.java:587)
12-14 15:32:50.017: E/AndroidRuntime(5102):     at android.os.Handler.dispatchMessage(Handler.java:92)
12-14 15:32:50.017: E/AndroidRuntime(5102):     at android.os.Looper.loop(Looper.java:130)
12-14 15:32:50.017: E/AndroidRuntime(5102):     at android.app.ActivityThread.main(ActivityThread.java:3687)
12-14 15:32:50.017: E/AndroidRuntime(5102):     at java.lang.reflect.Method.invokeNative(Native Method)
12-14 15:32:50.017: E/AndroidRuntime(5102):     at java.lang.reflect.Method.invoke(Method.java:507)
12-14 15:32:50.017: E/AndroidRuntime(5102):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
12-14 15:32:50.017: E/AndroidRuntime(5102):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
12-14 15:32:50.017: E/AndroidRuntime(5102):     at dalvik.system.NativeStart.main(Native Method)

My view is

    <ListView
        android:id="@id/android:list"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/transparent"
        android:cacheColorHint="#00000000" />
</LinearLayout>

<LinearLayout
    android:id="@+id/statelayoutStg"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_below="@id/state_ll"
    android:background="@drawable/mesh"
    android:orientation="vertical"
    android:visibility="invisible" >

    <ListView
        android:id="@id/android:list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@android:color/transparent"
        android:cacheColorHint="#00000000" />
</LinearLayout>

<LinearLayout
    android:id="@+id/citylayoutStg"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_below="@id/city_ll"
    android:background="@drawable/mesh"
    android:orientation="vertical"
    android:visibility="invisible" >

    <ListView
        android:id="@id/android:list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@android:color/transparent"
        android:cacheColorHint="#00000000" />
</LinearLayout>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T22:23:44+00:00Added an answer on June 15, 2026 at 10:23 pm

    I don’t think its possible for you to have three listviews with same id @id/android:list for a single ListActivity. And that should be the reason exactly.

    If you need to use 3 ListViews then I would suggest you to extend Activity and use Custom Adapters. Since you use same ids it raises the conflict.

    But still from my experience having multiple ListView in a same screen is not a good way to design UI.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Call to a member function bind_param() on a non-object I'm getting the
Possible Duplicate: Does Form.Dispose() call controls inside's Dispose()? is there a way to do
Possible Duplicate: CakePHP: Call to a member function find() on a non-object I have
Possible Duplicate: How to call javascript function from c# Is there a way to
Possible Duplicate: Can main function call itself in C++? I found this problem very
Possible Duplicate: how to make phone call by using objective c? I am trying
Possible Duplicate: C++ Vector Pointers to Objects Does std::list::remove method call destructor of each
Possible Duplicate: lambdas require capturing 'this' to call static member function? I want to
Possible Duplicate: Why is the 'this' keyword required to call an extension method from
Possible Duplicate: javascript object, access variable property name? I'm trying to call a method

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.