0

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.

  1. I request a WebService to retrieve my first elements (15 items more or less) of the ListView, with getLoaderManager().initLoader(0x01, null, this);
  2. If I scroll at the bottom of the ListView, I request to populate more items (20 items more or less), with AsyncTask.
  3. AsyncTask add more items to an ArrayAdapter, then I mArrayAdapter.notifyDataSetChanged();
  4. Click on the [TAB2] and then return to [TAB1]
  5. The initLoader is called again, BUT the ArrayAdapter 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
asked Dec 23, 2012 at 23:31

1 Answer 1

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

2 Comments

Thank you for the idea, I solved the question, as you say, changing this ListArray.
I'm newbe and I can't vote up your answer, I only have 6 point of reputation, and the minimum is 15.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.