In the above example directly inserted children values.like this
*private*
String<http://android.grepsrc.com/source/s?defs=String&project=ics-mr1>[][]
children <http://android.grepsrc.com/source/s?refs=children&project=ics-mr1>= {
{ "Arnold", "Barry", "Chuck", "David" },
{ "Ace", "Bandit", "Cha-Cha", "Deuce" },
{ "Fluffy", "Snuggles" },
{ "Goldy", "Bubbles" }
};
But i wish to need the children value is my xml parsed value.how is to
do.please help me.
On Wednesday, August 15, 2012 11:12:05 AM UTC+5:30, Jegadeesan M wrote:
>
> please check this link
> http://android.grepsrc.com/xref/ics-mr1/development/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList1.java
>
> On Monday, 13 August 2012 23:26:20 UTC-7, Krishna Veni wrote:
>>
>> Hi I have tried 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):payment_method.
>> Childname(CustomerInfo):name,email.
>>
>> How to do this?Please help me.
>>
>> this is my 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","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.
>>
>>
>>
>> );
>>
>> 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();
>>
>> map.put( "CustomerInfo","CustomerInfo"); // the key
>> and it's value.
>>
>> m.put( "OrderInfo", OrderInfo);
>>
>>
>>
>> result.add( m);
>>
>> }
>>
>> return (List)result;
>>
>>
>>
>> }
>>
>>
>>
>>
>>
>>
>> /* creatin the HashMap for the children */
>>
>> @SuppressWarnings("unchecked")
>>
>> private List createChildList() {
>>
>>
>>
>> ArrayList result = new ArrayList();
>>
>> for( int i = 0 ; i < 1 ; ++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 < 1 ; n++ ) {
>>
>> HashMap child = new HashMap();
>>
>> Intent in = getIntent();
>>
>> String payment_method = in.getStringExtra(KEY_ARTIST);
>>
>> TextView lblPayment = (TextView)
>> findViewById(R.id.payment_label);
>>
>> /// lblPayment.setText(payment_method);
>>
>> int payment;
>>
>> payment=1;
>>
>>
>>
>>
>>
>>
>>
>> String s= getIntent().getStringExtra("payment_method");
>>
>> String s1= getIntent().getStringExtra("total");
>>
>> String s2= getIntent().getStringExtra("subtotal");
>>
>> String s3= getIntent().getStringExtra("discount");
>>
>> String s4= getIntent().getStringExtra("coupon_discount");
>>
>> String s5= getIntent().getStringExtra("shipping_cost");
>>
>>
>> child.put( "KEY_ARTIST", s);
>>
>> child.put( "KEY_DURATION", s1);
>>
>> child.put( "KEY_SUBTOTAL", s2);
>>
>> child.put( "KEY_DISCOUNT", s3);
>>
>> child.put( "KEY_COUPON", s4);
>>
>> child.put( "KEY_COST", s5);
>>
>> secList.add( child);
>>
>> }
>>
>> result.add( secList );
>>
>> }
>>
>> return result;
>>
>> }
>>
>> Here my above code is not worked.So please help me I have to change what
>> line.
>>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en