android - how do I select a listview item and bring me to a new page? -


this question has answer here:

public void onlistitemclick(listview l, view v, int position, long id)          {             // when list item clicked             if ( position == 5)             {                 intent myintent = new intent(categories.this,adventure.class);                 startactivity(myintent);             }           } 

how select listview item , bring me new page?

you need set listiemclicklistner(); implement onlistitemclick activity class , then,

 listview lv = (listview)findviewbyid(r.id.lv);     lv.setonlistitemclicklistner(this); 

if have want, can set listner each listviews this.

lv.setonitemclicklistener(new onitemclicklistener() {      @override public void onitemclick(adapterview<?> arg0, view arg1,                     int position, long arg3) {              } }); 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -