Take the 2-minute tour ×

I am doing a file transfer application where you can transfer with 1 file to another. I am using a TabHost creating 2 tabs and in these 2 tabs 1 listview is the untouchable and the other is onclick will add an item to listview1.

My question is how does the other listview refresh itself when another tab is selected?. Does it just instantly transfer activity with no change at all or does it updates then shows?.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You have an ArrayAdapter for the first list that doesn't get touched.

Just do this with it's array adapter everytime you add/delete in your other list.

First get access to the array adapter of the untouchable list (here within a list fragment), then notify (or clear) it so it will update to the new data - having updated the array adapter's base data which shows the selected items, so that it actually has new content before it gets updated.

ArrayAdapter<String> myArrayAdapter = ((ArrayAdapter<String>) getListAdapter());
    if (myArrayAdapter != null) {
        //myArrayAdapter.clear(); use this to clear....
share|improve this answer
Oh I see. That makes sense using notifyDataSetChanged();. –  sdfwer Apr 12 '12 at 20:56
don't forget to mark this answer if it worked :-) –  user387184 Apr 13 '12 at 9:07
Oh right I forgot. I was suppose to mark it as soon as I saw your answer but then I it told me to wait a minute and I completely forgot :D. –  sdfwer Apr 13 '12 at 15:00

Your Answer


