Skip to content Skip to sidebar Skip to footer

Android's Arrayadapter - Add Strings Listview Instead Of Replace

This is how I add an array to listview: ListView my_listview = (ListView)findViewById(R.id.listView1); ArrayAdapter adapter = new ArrayAdapter(this, and

Solution 1:

You need to be using an ArrayList<String> my_array rather than a String[] my_array and then you can do:

my_array.addAll(other_array);

to add elements from a new array to your array. Then you can do:

adapter.notifyDataSetChanged();

to update your ListView with the new elements.

Post a Comment for "Android's Arrayadapter - Add Strings Listview Instead Of Replace"