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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:12:14+00:00 2026-05-28T19:12:14+00:00

i’m trying to call notifyDataSetChanged for my custom ExpandableListView. what happens is for my

  • 0

i’m trying to call notifyDataSetChanged for my custom ExpandableListView. what happens is for my child list, it shows the files in the selected folder (group list). when the child is clicked, it will ask whether to delete file or not. then, after delete, the ExpandableList will “refresh”. but somehow, i could not call the notifyDataSetChanged method.

my custom adapter :

public class customListAdapter extends BaseExpandableListAdapter {
    // Sample data set.  children[i] contains the children (String[]) for groups[i].
    private File mapFolder = new File (Environment.getExternalStorageDirectory(),"/MLT/A");
    private File recordFolder = new File (Environment.getExternalStorageDirectory(),"/MLT/B");
    private File scribbleFolder = new File (Environment.getExternalStorageDirectory(),"/MLT/C");
    private String[] groups = { "A", "B", "C" };
    private String[][] children = { mapFolder.list(), recordFolder.list(), scribbleFolder.list() };

    public Object getChild(int groupPosition, int childPosition) {
        return children[groupPosition][childPosition];
    }

    public long getChildId(int groupPosition, int childPosition) {
        return childPosition;
    }

    public int getChildrenCount(int groupPosition) {
        return children[groupPosition].length;
    }

    public View getChildView(int groupPosition, int childPosition, boolean isLastChild,
                                View convertView, ViewGroup parent) {

        TextView textView = new TextView(MLT_File.this);
        textView.setBackgroundColor(Color.BLACK);
        textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
        textView.setPadding(100, 5, 0, 5);
        textView.setTextColor(Color.WHITE);
        textView.setTextSize(23);
        textView.setId(1000);

        textView.setText(getChild(groupPosition, childPosition).toString());
        return textView;
    }//getChildView

    public Object getGroup(int groupPosition) {
        return groups[groupPosition];
    }

    public int getGroupCount() {
        return groups.length;
    }

    public long getGroupId(int groupPosition) {
        return groupPosition;
    }

    public View getGroupView(int groupPosition, boolean isExpanded, View convertView,
            ViewGroup parent) {
        TextView textView = new TextView(MLT_File.this);
        textView.setBackgroundColor(Color.WHITE);
        textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
        textView.setPadding(100, 0, 0, 0);
        textView.setTextColor(Color.BLACK);
        textView.setTextSize(25);
        textView.setText(getGroup(groupPosition).toString());

        return textView;
    }

    public boolean isChildSelectable(int groupPosition, int childPosition) {
        return true;
    }

    public boolean hasStableIds() {
        return true;
    }

    public void notifyDataSetChanged() {
        this.notifyDataSetChanged();
    }

}//customListAdapter

my onCreate :

// Set up our adapter
    listAdapter = new customListAdapter();

    expLV = (ExpandableListView) findViewById(R.id.mlt_expList);
    expLV.setAdapter(listAdapter);
    //registerForContextMenu(expLV);

    expLV.setOnChildClickListener(new OnChildClickListener()
    {
        @Override
        public boolean onChildClick(ExpandableListView parent, View v,
                int groupPosition, int childPosition, long id) 
        {
            // TODO Auto-generated method stub
            String parentName = "";
            if (groupPosition == 0)
            {
                parentName = "A";
            }

            else if (groupPosition == 1)
            {
                parentName = "B";
            }

            else if (groupPosition == 2)
            {
                parentName = "C";
            }

            TextView childView = (TextView) v;
            String childName = childView.getText().toString();

            File file = new File(Environment.getExternalStorageDirectory(),"/Folder/"+childName);
            file.delete();

            return false;
        }
    });//OnChildClickListener

the notifyDataSetChanged() in my custom is what i tried to do, as i realized i ExpandableList does not have that. but still, the method that i created does not appear either when i press expLV.n …

  • 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-28T19:12:15+00:00Added an answer on May 28, 2026 at 7:12 pm

    well… because nobody had really told me how to do it, i thought of a way that might be dumb but useful.

    what i did was rather then creating it in onCreate, i created it in onResume(). when i make any changes to it, it will be created again. reason for doing it is because i’m using TabMenu and when i switch between them, the class does not create again and therefore, causing the list to be in the same state.

    by using onResume, it also simplify my work as when i wanted it to refresh, all i have to do is call onResume().

    hope this help other people. =)

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

Sidebar

Related Questions

I'm trying to select an H1 element which is the second-child in its group
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

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.