Reputation: 43
Could someone recommend a good example of how to add an item from my listview to another listview after i click the item? i am having trouble with this and would like an example which i can follow from start to finish. Thanks
Upvotes: 0
Views: 1141
Reputation: 779
If your two listview use the same adapter (ie the same data type) you can use something like this :
listView1.setOnItemClickListener(this);
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
datasListView2.add(valuesListView1.get(position));
listView2.notifyDataSetChange();
}
Where dataListView1 and dataListView1 are your values arrays.
Upvotes: 1