Well, I want to create a list of Tournaments. Where each item will be added to the click of a button create tournament, following the pattern: tournament 1, tournament 2, tournament 3 ...
Well, I want to create a list of Tournaments. Where each item will be added to the click of a button create tournament, following the pattern: tournament 1, tournament 2, tournament 3 ...
Save a reference from the List that you pass as a parameter to the adapter. Also keep reference to the adapter
private final List<Torneio> torneios = new ArrayList<>();
private MyAdapter adapter;
In the click event of the button, add an element to the list and then ask the adapter to update the list
public void onButtonClick(View v) {
Torneio torneio = new Torneio("Torneio " + i);
this.torneios.add(torneio);
this.adapter.notifyDataSetChanged();
}