0
Guys, I want to create a list of tournaments. Where each item will be added at the click of a create tournament button, following the pattern: tournament 1, tournament 2, tournament 3 ...
0
Guys, I want to create a list of tournaments. Where each item will be added at the click of a create tournament button, following the pattern: tournament 1, tournament 2, tournament 3 ...
1
Keep a List reference that you will pass as a parameter to Adapter. Also save the reference to Adapter
private final List<Torneio> torneios = new ArrayList<>();
private MyAdapter adapter;
In the button click event, add an element to the list and then ask Adapter to update the list
public void onButtonClick(View v) {
Torneio torneio = new Torneio("Torneio " + i);
this.torneios.add(torneio);
this.adapter.notifyDataSetChanged();
}
Browser other questions tagged android listview android-adapter
You are not signed in. Login or sign up in order to post.