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 8252285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:31:20+00:00 2026-06-08T00:31:20+00:00

I have a xml file named socio_form_organization.xml that have two layout’s. This xml file

  • 0

I have a xml file named socio_form_organization.xml that have two layout’s. This xml file is inflated in a layout named content how we can see by the code below

socio_form_organization.xml

  <LinearLayout     
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/sfo_layout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/background_tile"
    android:orientation="vertical" >

  <LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/sfo_layout2"
      android:layout_width="wrap_content"
      android:layout_height="51dp"
      android:background="@drawable/background_tile"
      android:baselineAligned="true"
      android:orientation="horizontal">

      <Button
          android:id="@+id/sfo_btOrganization"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginBottom="2dp"
          android:layout_marginLeft="5dp"
          android:layout_marginRight="5dp"
          android:layout_marginTop="2dp"
          android:hint="@string/sfo_btOrganization" />

      <EditText
          android:id="@+id/sfo_etEmpresa"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_marginBottom="2dp"
          android:layout_marginTop="2dp"
          android:layout_weight="0.14"
          android:hint="@string/sfo_etEmpresa"
          android:inputType="textMultiLine"
          android:scrollHorizontally="false" />


      <ImageButton
          android:id="@+id/sfo_ivRemove"
          style="?android:attr/buttonStyleSmall"
          android:layout_height="60dp"
          android:layout_width="50dp"
          android:layout_marginTop="2dp"
          android:layout_marginBottom="2dp"
          android:layout_marginRight="5dp"
          android:onClick="onClick"
          android:background="@android:color/transparent"
          android:src="@drawable/tb_no_delete" />

  </LinearLayout>

    <EditText
        android:id="@+id/sfo_etTitulo"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="2dp"
        android:layout_marginLeft="65dp"
        android:layout_marginRight="55dp"
        android:layout_marginTop="2dp"
        android:layout_weight="0.14"
        android:hint="@string/sfo_etTitulo"
        android:inputType="textMultiLine"
        android:scrollHorizontally="false"  />

</LinearLayout>

Layout where is inflated the socio_form_organization.xml

 <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/se_contentOrganization"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="2dp"
        android:background="@drawable/background_tile"
        android:orientation="vertical" >

        <include
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="70dp"
            layout="@layout/socio_form_organization" />

In my class i do the inflation

    LayoutInflater inflaterOrganization=
    (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout organization =    
    (LinearLayout)inflaterOrganization.inflate(R.layout.socio_form_organization, null);
    LinearLayout lLayoutOrganization;
    lLayoutOrganization = (LinearLayout)findViewById(R.id.se_contentOrganization);
    lLayoutOrganization.addView(organization);

But now á need to remove the two layout inside the content when i click in ImageButton but i can’t.

I try with

    View toRemove = (View) view.getParent();
    ViewGroup vg = (ViewGroup)findViewById(R.id.se_content);
    vg.removeView(toRemove);

But only works when I have one layout. In this case I have two layout and don’t work.

I do not know if I could make you understand. Anyone can help me?
Thanks

  • 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-08T00:31:21+00:00Added an answer on June 8, 2026 at 12:31 am

    You are referencing two ids that do not exist in the layouts you provided:

    lLayoutOrganization = (LinearLayout)findViewById(R.id.se_contentOrganization);
    

    Where is se_contentOrganization? Did you mean se_contentEmail?

    And when you try to remove the views:

    ViewGroup vg = (ViewGroup)findViewById(R.id.se_content);
    

    Where is se_content? Or did you mean se_contentEmail? Or sfo_layout?

    Addition

    Try this:

    LinearLayout parent = (LinearLayout) findViewById(R.id.se_contentOrganization);
    LinearLayout child = (LinearLayout) findViewById(R.id.sfo_layout);
    parent.removeView(child);
    

    If you are using socio_form_organization.xml multiple times then try:

    LinearLayout child = (LinearLayout) view.getParent().getParent(); 
    LinearLayout parent = (LinearLayout) child.getParent(); 
    parent.removeView(child);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a layout xml file named my_layout.xml, in which the root view's layout_width
I have a RelativeLayout defined in an xml layout file named 'myview.xml' which contains
Let's say I have an existing trivial XML file named 'MyData.xml' that contains the
I have this problem where all URLs like context/path/file/anything/that/follows becomes context/path/file.php/anything/that/follows or context/path/file.xml/anything/that/follows .
I have a method named GetOrders . This method reads an XML file and
I have an xml file named Data.xml and it looks something like this <Data>
I have an xml file that looks like this: <args> <sometag value=abc /> <anothertag
I have a jar file named xyz.jar that have the file abc.xml and I
I have a bit of xml file named Sample.xml which is shown below <?xml
I have a file named configuration.xml which resides in classes folder of my WEB-INF

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.