java - How do I implement expandable List view setOnItemClickListener from button present in child view? -
i trying figure out how implement expandable list view setonitemclicklistener button present in child view. here's have far:
public view getchildview(int groupposition, int childposition, boolean islastchild, view convertview, viewgroup parent) { if (convertview == null) { layoutinflater infalinflater = (layoutinflater) context .getsystemservice(context.layout_inflater_service); convertview = infalinflater.inflate(r.layout.weekly_event_child_items, null); } button mybutton = (button) convertview.findviewbyid(r.id.button2); mybutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v1) { ((expandablelistview) parents).performitemclick(v1,positions, 0); } }); }
in main view have implemented:
expandablelistview.setonitemclicklistener(new adapterview.onitemclicklistener() { @override public void onitemclick(adapterview<?> adapterview, view view, int i, long l) { system.out.println("clicked"); } });
i expecting ((expandablelistview) parents).performitemclick(v1,positions, 0 somehow make call event handler in expandablelistview.setonitemclicklistener, not happening. want make call button click present in child view make call expandable listview's item click listener.
i think method below:
public void onclick(view v1) { ((expandablelistview) parents).performitemclick(v1,positions, 0); }
isn't implemented properly. if you're doing operation expandablelistview, can retrieve findviewbyid(...).
i think incorrect place set button event listener, since it's not related individual child views.
Comments
Post a Comment