I will throw my 2 cents into this discussion keeping in mind I am a
newbie android developer.
I was able to successfully use serialization to pass an object to and
return from another activity.
I hope this helps...
//this main activity will pass the gameParams (of type public class
GameOptionParams implements Serializable)
//to the GameOptions activity
Intent myIntent = new Intent(this, GameOptions.class);
Bundle b = new Bundle();
b.putSerializable("options", gameParams);
myIntent.putExtras(b);
startActivityForResult(myIntent,STATIC_OPTIONS_VALUE);
//in GameOoptions upon ready to return results
// prepare to send results back to invoker
Intent resultIntent = new Intent();
Bundle b = new Bundle();
b.putSerializable("options", gameParams);
resultIntent.putExtras(b);
setResult(Activity.RESULT_OK, resultIntent);
finish();
//and then back in the main to get the results
//return handler from invocation to GameOptions
@Override
public void onActivityResult(int requestCode, int resultCode,
Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
switch(requestCode)
{
case (STATIC_OPTIONS_VALUE) :
{
if (resultCode == Activity.RESULT_OK)
{
//retrieve intended options
Bundle b = data.getExtras();
gameParams = (GameOptionParams)
b.getSerializable("options");
On Sep 20, 12:57 pm, TreKing <[email protected]> wrote:
> On Tue, Sep 20, 2011 at 6:55 AM, John Goche <[email protected]>wrote:
>
> > given that A is beneath B on the activity stack and will not be reopened
>
> What do you mean A "will not be reopened" ?
>
> You're probably looking for startActivityForResult() and onActivityResult().
>
> -------------------------------------------------------------------------------------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices
--
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