android - How can I expand widget Expandable ListView to 10 layers? -
i'm developing expandable listview 10 layers .
i using following code second layer go forward .
i have used following code:
public void oncreate(bundle savedinstancestate) { try{ super.oncreate(savedinstancestate); setcontentview(r.layout.main); simpleexpandablelistadapter explistadapter = new simpleexpandablelistadapter( this, creategrouplist(), // creating group list. r.layout.group_row, // group item layout xml. new string[] { "group item" ,"level"}, // key of group item. new int[] { r.id.row_name ,r.id.row_name2}, // id of each group item.-data under key goes textview. createchildlist(), // childdata describes second-level entries. r.layout.child_row, // layout sub-level entries(second level). new string[] {"sub item","level"}, // keys in childdata maps display. new int[] { r.id.grp_child,r.id.grp_child2} // data under keys above go these textviews. ); setlistadapter( explistadapter ); // setting adapter in list. }catch(exception e){ system.out.println("errrr +++ " + e.getmessage()); } } /* creating hashmap row */ @suppresswarnings("unchecked") private list creategrouplist() { arraylist result = new arraylist(); for( int = 0 ; < 15 ; ++i ) { // 15 groups........ hashmap m = new hashmap(); m.put( "group item","شماره گروه " + ); // key , it's value. m.put( "level","لایه اول " ); result.add( m ); } return (list)result; } /* creatin hashmap children */ @suppresswarnings("unchecked") private list createchildlist() { arraylist result = new arraylist(); for( int = 0 ; < 15 ; ++i ) { // -15 number of groups(here it's fifteen) /* each group need each hashmap-here each group have 3 subgroups */ arraylist seclist = new arraylist(); for( int n = 0 ; n < 3 ; n++ ) { hashmap child = new hashmap(); child.put( "sub item", "شماره زیر گروه " + n ); child.put( "level", "لایه دوم "); seclist.add( child ); } result.add( seclist ); } return result; } public void oncontentchanged () { system.out.println("oncontentchanged"); super.oncontentchanged(); } /* function called on each child click */ public boolean onchildclick( expandablelistview parent, view v, int groupposition,int childposition,long id) { system.out.println("inside onchildclick @ groupposition = " + groupposition +" child clicked @ position " + childposition); return true; } /* function called on expansion of 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()); } }
please solution comes mind in context give me.
meanwhile
output program following image the:
Comments
Post a Comment