On Sun, Sep 19, 2010 at 2:59 PM, GregAZ <[email protected]> wrote:
> I think I'm missing something.  If I add the string as an extra to the
> image picker intent, then show that intent, that extra is gone in the
> onActivityResult.

Correct.

> Even with setResult it's still gone.  This is on my
> HTC Hero:
>
>        Intent i = new Intent(Intent.ACTION_PICK,
> android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI);
>        i.putExtra("url", url);
>        setResult(1, i);
>        startActivityForResult(i, 1);

You do not call setResult() here. That is for use in the activity that
is *started* by startActivityForResult().

> In the onActivityResult:
> String url = intent.getStringExtra("url");
>
> It's null.

Correct.

If you are implementing the activity being started by
startActivityForResult(), in that activity, you can use extras with
setResult(). In this case, somebody else wrote that activity. Extras
you put on the requesting Intent will not automatically be copied to
the response Intent.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.1 Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en

Reply via email to