Hi Mark,

Can you give me an example? I have been looking for a sample app for
better understanding.

First Activity: send_to.java
Second Activity: contact_list.java

Step #1: In send_to.java, on Button Press,

         Intent newIntent = new Intent(v, contact_list.class);
         startActivityForResult(newIntent, 0);

Step #2: In contact_list.java class, ListView items with checkboxes,
and two buttons "OK" and "CANCEL". When OK button is pressed, pass the
names of ListView items that are checked, to the first activity
(send_to.java)

         setResult(RESULT_OK, Intent data);

         How do I bundle the checkbox status to the Intent data?

Step #3: Back in the calling activity, send_to.java, I need to
override onActivityResult(int requestCode, int resultCode, Intent
data). Is this correct?

Thanks,

Abhi

On Jan 3, 8:57 pm, "Mark Murphy" <mmur...@commonsware.com> wrote:
> > How can we pass checked box status from one activity to the calling
> > activity?
>
> > For e.g., I have two activities. The first activity calls the second
> > activity that has a listview with checkboxed items and two buttons,
> > 'OK' and 'CANCEL'. The second activity has to pass the names of list
> > items that are checked to the calling acitivity. I am not able to
> > figure out how to do this efficiently?
>
> Step #1: Have the first activity use startActivityForResult() to invoke
> the second activity
>
> Step #2: Have the second activity call setResult() after the user makes
> her selections, encoding the various bits of information in the Intent
> supplied to setResult() (e.g., as extras)
>
> Step #3: Have the first activity override onActivityResult() to get the
> Intent created in Step #2.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
> Android App Developer Books:http://commonsware.com/books.html

-- 
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

Reply via email to