Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

Get excited for the Samsung Galaxy S5! Find everything you need and discuss it in our Galaxy S5 Forum!

test: Reply
 
LinkBack Thread Tools
Old August 14th, 2012, 12:16 AM   #1 (permalink)
Member
Thread Author (OP)
 
Join Date: Dec 2011
Location: chennai
Posts: 158
 
Device(s):
Carrier: Not Provided

Thanks: 1
Thanked 0 Times in 0 Posts
Default Create 2 groups in android expandable listview

Hi i have try to develop expandable listview in android application.now i have one doubts.how is creating 2 groups ion below my code for separate child details...For Eg:
Group name:
OrderInfo,CustomerInfo.
Childname(OrderInfo)ayment_method.
Childname(CustomerInfo):name,email.How is to do.Please help me.

My code is:
Code:
 SimpleExpandableListAdapter expListAdapter =
            new SimpleExpandableListAdapter(
                    this,
                    
                    createGroupList(),              // Creating group List.
                    R.layout.group_row,  
                  // Group item layout XML.
                    new String[] { "OrderInfo","CustomerInfo"},  // the key of group item.
                    new int[] { R.id.order,R.id.customer},
                    
                    // ID of each group item.-Data under the key goes into this TextView.
                    createChildList(),              // childData describes second-level entries.
                    R.layout.single_list_item,  
                  //  new String[] {"KEY_ARTIST"},  
                   // new int[] { R.id.payment_label}  // Keys in childData maps to display.
                      // Layout for sub-level entries(second level).
                   new String[] {"KEY_ARTIST","KEY_DURATION","KEY_SUBTOTAL","KEY_DISCOUNT","KEY_COUPON","KEY_COST"},  
                   new int[] { R.id.payment_label,R.id.total_label,R.id.discount_label,R.id.discount_label,R.id.coupon_label,R.id.cost_label}// Keys in childData maps to display.
                 //   new int[] { R.id.payment_label,R.id.total_label}     // 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 = 0 ; i < 1 ; ++i ) { // 15 groups........
            HashMap m = new HashMap();
           m.put( "CustomerInfo","CustomerInfo"); // the key and it's value.
           m.put( "OrderInfo", OrderInfo);
         
            result.add( m );
          }
          return (List)result;
          
    }
Here my above code is not worked..so please help me i have to change what line.

krishnaveni is offline  
Reply With Quote
sponsored links
Reply
Tags
android, expandablelistview


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 04:17 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.