Matt wrote: > On 16 Aug., 01:23, Mark Murphy <[email protected]> wrote: >> You don't remove it from the list. You remove it from the data source >> underlying the list. >> >> -- ArrayAdapter? Remove it straight from the adapter. >> >> -- CursorAdapter? Remove it from the database or content provider, then >> requery(). >> >> -- Other adapter? Ummmm...it should have similar stuff. > > How exactly do I remove something from the adapter? Do you really mean > the adapter or do you mean the actual array? > Here is what I did so far: > > String[] names = {"John", "George", "Jim"}; > > ArrayAdapter<String> adapter = new ArrayAdapter<String>( > this, > android.R.layout.simple_list_item_1, > names); > > setListAdapter(adapter); > > I tried to use the method adapter.remove("John"); but that resulted in > a runtime error. What am I doing wrong?
You gave it an array. To be able to modify it at runtime, you need to give it an ArrayList. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Looking for Android opportunities? http://wiki.andmob.org/hado --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

