0
I am a beginner in Java/Android programming, and would like a help with adding items to a Listview.
The app receives the first 5 records from a Json (Url), and adds in Listview, so far, all right.
The app then displays a button, which when clicking, queries the next 5 records.
Here is my doubt: the app replaces the first 5 records for the next 5, and I need this new content query to be added to the end of Listview and not replace what was already.
Go below, snippets of the code
Main Activity
// Populando Campeoes ListView
private void popularCampeoes() {
    ArrayList<Campeoes> newCampeoes = Campeoes.fromJson(JsonCampeoes);
    CampeoesAdapter adapterCampeoes = new CampeoesAdapter(this, newCampeoes);
    ListView listClubeCampeoes = (ListView) findViewById(R.id.listClubeCampeoes);
    listClubeCampeoes.setAdapter(adapterCampeoes);
}
With Json downloaded, the app invokes the popularCampeoes method();
Campeoesadapter
class CampeoesAdapter extends ArrayAdapter<Campeoes> {
    CampeoesAdapter(Context context, ArrayList<Campeoes> campeoes) {
        super(context, 0, campeoes);
    }
    private Context context;
    @NonNull
    @Override
    public View getView(int position, View convertView, @NonNull ViewGroup parent) {
        final Campeoes campeoes = getItem(position);
        if (convertView == null) {
            convertView = LayoutInflater.from(getContext()).inflate(R.layout.campeoes_linha, parent, false);
        }
        TextView tvTitulo = (TextView) convertView.findViewById(R.id.clubeCampTitulo);
        TextView tvConteudo = (TextView) convertView.findViewById(R.id.clubeCampConteudo);
        assert campeoes != null;
        tvTitulo.setText(campeoes.CampTitulo);
        tvConteudo.setText(campeoes.CampConteudo);
        return convertView;
    }
}
I thank you immediately, any help you have.
Perfect ramaral, with its simple and objective explanation, I was able to understand the difference between the form that was written and the form that Oce left as an example. Thank you very much !!!!
– Leandro Santana