I'm just not getting the documentation on Intents.  I have two
Activities A and B.  Activity A calls Activity B based on a menu
selection.  This is my code snippet:

ccase R.id.MENU_SELECTION:
     Intent intent=new Intent(Intent.ACTION_ATTACH_DATA);
     intent.setClass(MainClass.this,ReturnClass.class);
     startActivityForResult(intent,Intent.FILL_IN_DATA);
     break;

 What I ultimately want is for Activity B to return a number to me.
In the above, I select Intent.ACTION_ATTACH_DATA  mainly because I
didn't know what else to select.  The setClass specifies the class for
Activity A and the destination class (the class for Activity B).  In
the startActivityForResult, I pass the intent.  The
Intent.FILL_IN_DATA is also because
 I didn't know what else to select, but I do want data returned.

 In anticipation for the Result, I have added the following in my
MainClass:

 protected void OnActivityResult(int requestCode, int resultCode,
Intent data)
 {
     if (requestCode==Intent.FILL_IN_DATA)
     {
         if (resultCode==RESULT_OK) {
            String theAnswerThatIWantReturned=data.getStringExtra(????);
         }
     }
 }

 Whether the above is correct or not, I do end up in Activity B.  In
Activity B, when I return, based on  either a menu selection or button
click, I have no idea what to return.  I assume it will look
 something like:

     String theAnswerIWantToReturn="something";
     Intent intent=new Intent();
     intent.setClass(ReturnClass.this,MainClass.class);
     startActivity(intent);

But I can't figure out what the correct syntax might be.  Can someone
please help or at least point me to an example that I might be able to
follow?

Thanks;

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