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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:02:23+00:00 2026-05-18T11:02:23+00:00

I am trying to delete Group when selected in my Expandable List and having

  • 0

I am trying to delete Group when selected in my Expandable List and having the list refreshed after the delete occurred.

I took the source code from google:

http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList1.html

I tried a couple of ways to delete it, but no success, anyone achieved that already?

Thanks,
ray.

  • 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-05-18T11:02:24+00:00Added an answer on May 18, 2026 at 11:02 am

    Answer for the second question (Add rows to a child & datastructure)

    For the Datastructure:

    public class GroupItem {
     private String mItemText;
     private List<ChildItem> mChildItems=new ArrayList<ChildItem>();    
    
     public GroupItem(String itemText) {
      mItemText=itemText;
     }
    
     public String getItemText() {
      return mItemText;
     }
    
     public ChildItem getChild(int childPosition) {
      return mChildItems.get(childPosition);
     }
    
     public void addChild(ChildItem childItem) {
      return mChildItems.add(childItem)
     }
    
     public void removeChild(int childPosition) {
      return mChildItems.remove(childPosition);
     }
    
    }
    
    public class ChildItem {
     private String mItemText;
     public ChildItem(itemText) {
      mItemText=itemText;
     }
    
     public String getItemText() {
      return mItemText;
     }
    }
    

    Now to set it up you would do something like:

    List<GroupItem> items = new ArrayList<GroupItem>();
    
    GroupItem item1 = new GroupItem("This is group 1");
    item1.addChild(new ChildItem("This is a child item of group 1"));
    item1.addChild(new ChildItem("This is another child item of group 1"));
    

    and so on…

    Then, in the Adapter you would need to return the appropriate data.

    For your question concerning rows:
    In your Google example, they return a TextView. You can however make your own Layout with whatever content you like. For example:

    <ImageView android:id="@+id/RowIcon" 
      android:layout_width="56px" 
      android:layout_height="56px" 
      android:layout_marginLeft="12px" 
      android:layout_marginTop="2px">
    </ImageView>
    <TextView android:id="@+id/RowTextView"
         android:paddingLeft="10px"
         android:paddingTop="10px"       
         android:layout_width="wrap_content"
         android:layout_height="wrap_content" android:textColor="#666666" android:textSize="14px"/>
    
    
    </LinearLayout>
    

    And then use this Layout in your Adapter. Instead of returning, say, a TextView, you’ll just return this as a View:

    public View getChildView(int groupPosition, int childPosition, boolean isLastChild,
                View convertView, ViewGroup parent) {
    
    LayoutInflater mInflater = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View rowView = mInflater.inflate(YOUR XML FILE FROM ABOVE, null);
        ImageView rowIcon = (ImageView)rowView.findViewById(R.id.RowIcon);
        iconType.setBackgroundResource(AN IMAGE HERE);
        TextView rowText =(TextView)rowView.findViewById(R.id.RowTextView);
        textAddress.setText(items.get(groupPosition).getChild(childPosition));
    
        return rowView;
     }
    

    So, i think that should get you going.

    Also, please accept my answers if they satisfy you.

    Cheers.

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

Sidebar

Related Questions

I am trying to delete a line from a text file in java, I
I am trying to delete multiple rows from a GridView but I am struggling
I'm trying to delete items from a ListView using a custom adapter which extends
I am trying to delete both a matrix in mathematica. An inelegant way of
I am trying to delete the duplicate atrists that are displayed when I retrieve
I am trying to delete multiple records using check boxes. I've loaded each check
I am trying an rspec test where the example looks like so: it cannot
I am writing a piece of code with high demands on performance where I
Based on my research, this is a very common problem which generally has a
Hey again, im still getting a hang of Queries and stuff so please excuse

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.