android - How do I put a specific item in my ListView in an intent? -


arrayadapter<comment> adapter = new arrayadapter<comment>(this,             android.r.layout.simple_list_item_1, values);     // setlistadapter(adapter);      final listview listview = (listview) findviewbyid(r.id.list);     listview.setadapter(adapter);      listview.setonitemclicklistener(new onitemclicklistener() {         public void onitemclick(adapterview<?> parent, view view,                 int position, long id) {      }); 

how item in listview clicked , store in intent (i know how store in intent, need item clicked)?

after implement onitemclicklistener interface:

public void onitemclick(adapterview<?> parent, view view, int position, long id) {     intent intent = new intent(getactivity(), nextactivity.class);      //since have values inside array; can use position     //the selected value      intent.putextra("key", values.get(position));      startactivity(intent); } 

i hope helped!


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -