Thanks MarkMurphy.

But still i am not able to clear list items and populate with new
items,,,new items get added up to old items.

my code is this

ArrayAdapter<String> adapter;
    ArrayList<String> results=new ArrayList<String>();

    private void populateStationsList(RadioStation[] radioStation){
        results.clear();
        stationsList=(ListView) findViewById(R.id.station_list);


stationsList.setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);

         for (int i=0; i<radioStation.length; i++) {
             String s=radioStation[i].getName();

                 results.add(s);
         }
         stationsList.setSelectionFromTop(1, 1);

        adapter = new ArrayAdapter<String>(this,
                 android.R.layout.simple_list_item_1, results);

         stationsList.setAdapter(adapter);
         adapter.notifyDataSetChanged();
         stationsList.setOnItemClickListener(this);

    }



On Fri, Mar 19, 2010 at 6:31 PM, Mark Murphy <mmur...@commonsware.com>wrote:

> kavitha wrote:
> > Hi All,
> >
> > How to remove all Items in a ListView in android.
> >
> > I want to remove all items in list view and populate with new items
> > dynamically from a background thread.
> >
> > Please tell,,this is very urgent.
>
> Replace the adapter used by the ListView.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://twitter.com/commonsguy
>
> Android Training in US: 14-18 June 2010: http://bignerdranch.com
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
> To unsubscribe from this group, send email to android-developers+
> unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> ME" as the subject.
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to