passing data from list view to another activity

前端 未结 6 2080
再見小時候
再見小時候 2020-12-18 15:23

i want to create an activity, in which, i would like to have a listview, there can be about 20-30 items in a list view,on tapping any particular value in listview, it should

6条回答
  •  北海茫月
    2020-12-18 15:58

    protected void onListItemClick(ListView l, View v, int position, long id) {
       super.onListItemClick(l, v, position, id);
    
       Object obj = this.getListAdapter().getItem(position);
       String value= obj.toString();
    
       Intent intent= new Intent(CurrrentClass.this,NextClass.class);
       intent.putExtra("value", value);                 
       startActivity(intent);    
    }
    

    Hope this will help you.

提交回复
热议问题