Hi, Thanks for the tips. Is it possible to pass an arbitrary object to the child activity and back ? The examples I saw were setting stuff inside the intent itself. For example, from parent to child, I query a content provider that returns a bunch or rows displayed by list activity. Once user selects one of the items from the list, i want to get the corresponding row from the list adapter and pass it to child activity. So, I was hoping to do something like below:
protected void onListItemClick(ListView l, View v, int position, long id) { ... ... Intent i = new Intent(this, ChildActivity.class); i.putExtra(ChildActivity.KEY_ITEM, myAdapter.getItemId((int)id)); startActivityForResult(i, ENTRY_CREATE); ... ... } My child activity might not also need to send back an object to the parent (i am not sure if it is needed at this point in my app. but ..) but not sure if it can be done. Thanks, Sarath On Sat, Dec 27, 2008 at 6:05 PM, Emmanuel <emmanuel.ast...@gmail.com> wrote: > > Call the second activity with startActivityForResult, add a SetResult > ( ... ) with your result just before calling finish in your second > activity, then in your first activity, onActivityResult will be > called, where you can treat your results. > > Hope it helps, > > Emmanuel > http://androidblogger.blogspot.com/ > > On Dec 27, 7:30 pm, "Sarath Kamisetty" <sarath.kamise...@gmail.com> > wrote: >> Hi, >> >> Is there any example out there where one activity creates another >> activity and the new activity returns something to the old one ? In my >> application, when user clicks on a button, I need to move to a new >> activity where I display a list of items and once the user selects one >> of them I have to pass that data value back to the first activity >> where it is displayed in a text field. I see that the notepad v3 >> example comes close but not quite. >> >> Thanks, >> Sarath > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---