OK. Thanks for the answer.
The way you've explained, to put the object in the extras, is the way
I
actually do. But the extras aren't able to store any object at the
normal way.
I take the indirection through a HashMap. Like you'll see in the Code
below,
the concerning object is a PackageInfo.
=== CODE -> Calling Activity ===
...
Intent i = new Intent(CallingActivity.this, RetrievingActivity.class);
HashMap<String, PackageInfo> map = new HashMap<String, PackageInfo>();
map.put("MyPackageInfo", pi);
i.putExtra("map", map);
startActivity(i);
...
=== END ===
=== CODE -> Recieving Activity ===
...
Bundle extras = getIntent().getExtras();
HashMap<String, PackageInfo> map = (HashMap<String, PackageInfo>)
extras.get("map");
PackageInfo pInfo = map.get("MyPackageInfo");
...
=== END ===
This seems to be circumstantial, isn't it? Maybe I'm wrong with my
solution but in
the documentation I saw there is a way to put a serializable object to
the extras.
So I put the PackageInfo into the HashMap (which is serializable) and
the HashMap
to the extras.
=== QUOTE -> Andrew Stadler ===
...Remember that Intent data must be
parcelable so that it can be transported between processes.
=== END ===
As per documentation, PackageInfo extends Parcelable. That means
I can solve my problem by calling "myIntent.putExtra("myIntent",
myPackageInfo);"
and inversely "myPackageInfo = myIntent.getExtra("myIntent);"
...Wait...
OK, this is tested and seems to work. Thank you very much for your
help.
I'm not new to development, but I'm new to Java and to android too.
Regards
OC
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---