Android ListView with onClick items

前端 未结 9 1591
梦如初夏
梦如初夏 2020-11-27 03:33

I\'m a new programmer and new in Android. I\'m using this example http://www.androidhive.info/2012/09/android-adding-search-functionality-to-listview/ and it works great.

9条回答
  •  渐次进展
    2020-11-27 04:05

    well in your onitemClick you will send the selected value like deal , and send it in your intent when opening new activity and in your new activity get the sent data and related to selected item will display your data

    to get the name from the list

    String item = yourData.get(position).getName(); 
    

    to set data in intent

    intent.putExtra("Key", item);
    

    to get the data in second activity

    getIntent().getExtras().getString("Key")
    

提交回复
热议问题