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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:26:11+00:00 2026-06-13T10:26:11+00:00

In my android application I have checkboxes and on checking the checkboxes I want

  • 0

In my android application I have checkboxes and on checking the checkboxes I want to set the visibility of the group element of ExpandableListView and also I want to set the title of group element to be the same as checkbox name.

 public void onCreate(Bundle savedInstanceState) {
    try{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.detailnewslist);

    SharedPreferences settings = getSharedPreferences("mysettings", MODE_WORLD_READABLE);
    boolean checkBoxValue1=settings.getBoolean("c1",false);
    boolean checkBoxValue2=settings.getBoolean("c2",false);
    /*if(checkBoxValue1==true)
    {
        t1.setText(settings.getString("checkbox", "null"));
    }else{t1.setVisibility(View.GONE);}
    if(checkBoxValue2==true){
        t2.setText(settings.getString("checkbox1", "null"));
    }else{t2.setVisibility(View.GONE);}
    */
     SimpleExpandableListAdapter expListAdapter =
            new SimpleExpandableListAdapter(
                    this,
                    createGroupList(),              // Creating group List.
                    R.layout.group_row,             // Group item layout XML.           
                    new String[] { "Group Item" },  // the key of group item.
                    new int[] { R.id.row_name },    // ID of each group item.-Data under the key goes into this TextView.                   
                    createChildList(),              // childData describes second-level entries.
                    R.layout.child_row,             // Layout for sub-level entries(second level).
                    new String[] {"Sub Item"},      // Keys in childData maps to display.
                    new int[] { R.id.grp_child}     // Data under the keys above go into these TextViews.
                );
            setListAdapter( expListAdapter );       // setting the adapter in the list.

        }catch(Exception e){
            System.out.println("Errrr +++ " + e.getMessage());
        }
    }

    /* Creating the Hashmap for the row */
    @SuppressWarnings("unchecked")
    private List createGroupList() {

          ArrayList result = new ArrayList();
          for( int i = 1 ; i < 16 ; ++i ) { // 15 groups........
            HashMap m = new HashMap();
            m.put( "Group Item","Group I " + i ); // the key and it's value.
            result.add( m );
          }
          return (List)result;
    }

    /* creatin the HashMap for the children */
    @SuppressWarnings("unchecked")
    private List createChildList() {

        ArrayList result = new ArrayList();
        for( int i = 1 ; i < 16 ; ++i ) { // this -15 is the number of groups(Here it's fifteen)
          /* each group need each HashMap-Here for each group we have 3 subgroups */
          ArrayList secList = new ArrayList(); 
          for( int n = 0 ; n < 5 ; n++ ) {
            HashMap child = new HashMap();
            child.put( "Sub Item", "Sub Item " + n );           
            secList.add( child );
          }
         result.add( secList );
        }        
        return result;
    }
    public void  onContentChanged  () {
        System.out.println("onContentChanged");
        super.onContentChanged();         
    }
    /* This function is called on each child click */
    public boolean onChildClick( ExpandableListView parent, View v, int groupPosition,int childPosition,long id) {
        System.out.println("Inside onChildClick at groupPosition = " + groupPosition +" Child clicked at position " + childPosition);
        return true;
    }

    /* This function is called on expansion of the group */
    public void  onGroupExpand  (int groupPosition) {
        try{
             System.out.println("Group exapanding Listener => groupPosition = " + groupPosition);
        }catch(Exception e){
            System.out.println(" groupPosition Errrr +++ " + e.getMessage());
        }
} 
  • 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-13T10:26:11+00:00Added an answer on June 13, 2026 at 10:26 am

    The key method in ExpandableListView is:

        public View getGroupView(int groupPosition, boolean isExpanded, View convertView,
            ViewGroup parent) { ... }
    

    See how it is implemented, for example, to show/hide the disclosure when there are no children.

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

Sidebar

Related Questions

I have an Android application that displays a list of names using checkboxes. I
In android application i have a custom listview and sqlite database. I want to
i made android application. In application i have web view where i want to
In my Android application I have used a Listview and in each element in
I am learning how to set up preferences in an android application. I have
In my Android application I have to use common string value for all activities.
In my Android Application i have to download video from Amazon bucket. When I
in my android application I have a socket, but when I rotate the screen,
In my Android Application I have a Google MapView Activity and I am facing
i'm building an android application which have a chat. in this chat i each

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.