android - Listview item click issue -
i have added leadbolt ad(entry ad). advertising works correctly listview.click doesn't work when close ad close sign. (listview.click not anything, works when remove adcontroller)
public class soundlist extends listactivity { int [] soundfile; mediaplayer mediaplayer; private adcontroller mycontroller; final activity act = this; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); mycontroller = new adcontroller(act, "111111111"); mycontroller.loadad(); soundfile= new int[] {r.raw.sound1,r.raw.sound2.....}; string[] sounds= getresources().getstringarray(r.array.sounds); // binding array listadapter this.setlistadapter(new arrayadapter<string>(this, r.layout.list_item, r.id.label, sounds)); listview lv = getlistview(); lv.setdescendantfocusability(listview.focus_block_descendants); // listening single list item on click lv.setonitemclicklistener(new onitemclicklistener() { public void onitemclick(adapterview<?> parent, view view, int position, long id) { intent intent = new intent(getapplicationcontext(), singlelistitem.class); intent.putextra("position", position); startactivity(intent); } }); }
having focusable item in row of listview causes onitemclicklistener not invoked.
to fix issue add following code row view.
xml:
android:descendantfocusability="blocksdescendants"
java:
listitem.setdescendantfocusability(focus_block_descendants);
Comments
Post a Comment