Thanks, Justin, that has solved the problem. On 27 July, 22:00, Justin Anderson <janderson....@gmail.com> wrote: > Use startActivityForResult instead of startActivity. Then when you get back > to the listView you can add the item and update there. There are some very > specific things you need to do to get startActivityForResult to work > properly and return the stuff you want to return to the main activity, so > you may want to search StackOverflow and this group for > startActivityForResult... > > Hope that helps, > Justin > > ---------------------------------------------------------------------- > There are only 10 types of people in the world... > Those who know binary and those who don't. > ---------------------------------------------------------------------- > > > > On Tue, Jul 27, 2010 at 2:35 PM, nimusi <nimus...@gmail.com> wrote: > > I have an app in which the main activity is a listview. Clicking on > > an item in the list item opens a new activity which is a detail view > > of that item. The detail view has navigate buttons which traverse > > through the list displaying details for the currently selected item. > > This is working as expected. > > > Users need to be able to add, edit and delete items. In the main > > activity I have an 'Add Item' menu item which allows the user to add > > an item. The detail view has an 'Add Item' button. > > > I thought I would be able to reuse the code for both cases by opening > > a dialog in a helper class which accepts a new item and updates the > > list view (and also the detail view if that was where it was called > > from). This is raising an Exception 'The content of the adapter has > > changed but ListView did not receive a notification'. > > > Having googled this I am told that I cannot update the UI thread in a > > sub-thread. Does this mean that I have to replicate the add item code > > in each activity? Or am I going about this in the wrong way and I > > should be doing something else. > > > NiMuSi > >http://www.nimusi.net/blog > > > -- > > 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- Hide quoted text - > > - Show quoted text -
-- 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