Sunday 15 June 2014

android - Add Click Event to Expandable List View Child While Extending Activity instead of Activity? -


I want to add child's click event to the extended ListView ... I do not want to increase the activity because I have Add another listview here ... bellow ... Now I want to add child to the event of clicking .... Any help please ....

  Package Com Examples. Import java.util.ArrayList; Import java.util.list; Import com.example.events.GroupEntity.GroupItemEntity; Import android App Importroid.os.Bundle; Import android.view.View; Import android.widget.ExpandableListView; Import android.widget.ExpandableListView.OnChildClickListener; Import android.widget.Toast; Public class enhances main activity activities OnChildClickListener {Private ExpandableListView mExpandableListView; Private listing & lt; GroupEntity & gt; MGroupCollection; String url; @ Override protected void saved create (bundled Instansstet) {Suprknkret (saved Instensstet); SetContentView (R.layout.event_mainactivity); PrepareResource (); Initpage (); } Private zero-ready resources () {mGroupCollection = New ArrayList & lt; GroupEntity & gt; (); {GroupEntityGE = New GroupType} for (IntiI = 1; I & lt; 3; i ++); GEname = "group" + i; For (Int J = 1; J & lt; 4; J ++) {GroupTime Inti GI = GE New Group Item Entity (); G. name = "hair" + J; Ge.GroupItemCollection.add (GI); } MGroupCollection.add (ge); }} Private Zero initPage () {mExpandableListView = (ExpandableListView) findViewById (R.id.expandableListView); Expandable List Adapter Adapters = New Expandable List Adapters (This, Mxpandablablelist, MgutCollection); MExpandableListView.setAdapter (adapter); } @ Override Public Boolean on Childclick (Expanded List We Parent, We V, Int Groupposition, Intimate Child Position, Long ID) {Toast. GetApplicationContext, childposition + "clicked", toast. LNNGH_LOG). Show (); Back true; }}    

Forgetting add to childclick to see you try it:

  Private Zero Init Page () {mExpandableListView = (ExpandableListView) findViewById (R.id.expandableListView); Expandable List Adapter Adapters = New Expandable List Adapters (This, Mxpandablablelist, MgutCollection); MExpandableListView.setAdapter (adapter); MExpandableListView.setOnChildClickListener (this); }   

Good luck.

No comments:

Post a Comment