I will try to explain my problem with adding elements to my ArrayAdapter
and refresh the ListView
:
I have two tabs [TAB1][TAB2], with two Fragments
and attached with TabListeners
.
- I request a
WebService
to retrieve my first elements (15 items more or less) of theListView
, withgetLoaderManager().initLoader(0x01, null, this);
- If I scroll at the bottom of the
ListView
, I request to populate more items (20 items more or less), withAsyncTask
. AsyncTask
add more items to anArrayAdapter
, then ImArrayAdapter.notifyDataSetChanged();
- Click on the [TAB2] and then return to [TAB1]
- The
initLoader
is called again, BUT theArrayAdapter
still have the elements of the first call!
I'm missing something? I need to store the ArrayAdapter
, onSaveInstance
or similar?
Thank you in advance.
prolink007
34.7k24 gold badges124 silver badges191 bronze badges
1 Answer 1
when you create ArrayAdapter you send a ListArray to it.when you want change content .you only change this listArray then where you do't want Listview show your already items you should empty this listArray.
answered Dec 24, 2012 at 5:52
user1525382user1525382
default