You are going to have to be a little more clear about what is happening... *> Here replpulateList() method will add to listview items. It doent remove/replace all listview items.* Does it replace any of the items?
I have never actually used ArrayAdapter the way you are trying to... I typically would create a class that extends ArrayAdapter<String> and override the getView() method... I have never run into the issue you are having so perhaps it has something to do with that? Also, one other thing I noticed in some of my code is that I call setListAdapter() rather than setAdapter... Not sure if that has anything to do with your problem but it would be worth a shot to try it out... Sorry I can't be of more assistance... I haven't used ListView very much in my own code. ---------------------------------------------------------------------- There are only 10 types of people in the world... Those who know binary and those who don't. ---------------------------------------------------------------------- On Thu, Apr 1, 2010 at 1:06 AM, kavitha <kavith...@gmail.com> wrote: > > > > Hi all,, > > Can somebody please give me an example code of removing all ListView items > and replacing with new items. > > I tried replacing the adapter items.Still no results. > > my code is > > at first i am calling > > populateList(){ > > results -populated arraylist with strings > > ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, > android.R.layout.simple_list_item_1, results); > listview.setAdapter(adapter); > adapter.notifyDataSetChanged(); > listview.setOnItemClickListener(this); > > > > } > > // now populating list again > > repopulateList(){ > > results1-populated arraylist with strings > > ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(this, > android.R.layout.simple_list_item_1, results1); > listview.setAdapter(adapter1); > adapter1.notifyDataSetChanged(); > listview.setOnItemClickListener(this); > } > > > Here replpulateList() method will add to listview items. It doent > remove/replace all listview items. > > Please Help. > > > Thanks > Kavitha > > -- > You received this message because you are subscribed to the Google > Groups "Android Beginners" group. > > NEW! Try asking and tagging your question on Stack Overflow at > http://stackoverflow.com/questions/tagged/android > > To unsubscribe from this group, send email to > android-beginners+unsubscr...@googlegroups.com<android-beginners%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-beginners?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en To unsubscribe, reply using "remove me" as the subject.