[android-developers] passing values from Activity to Activity

2010-02-11 Thread MobDev
Hi,
I have an app which makes use of several layout-views...Every layout-
view also got a class for it, which extend the Activity class...
One class for example retrieves some database values whilst offering a
search form to the user...  Afterwards the user can select one of
those values and he gets presented with another screen which gives
similar options as the one selected...
Anyways, I'd like for the first Activity to be able to send an array
with data (Strings for example) to the second one...
Right now I show an activity by using :

Intent i = new Intent(this, activitysName.class);
startActivity(i);

I have no idea whilst using this construction how I can initialize
the new object with the String array I want to pass to it...
So how should this be achieved ? Should I be using something else
instead of an Intent-Activity combination ?

Thanks in advance

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


Re: [android-developers] passing values from Activity to Activity

2010-02-11 Thread Mark Murphy
 Anyways, I'd like for the first Activity to be able to send an array
 with data (Strings for example) to the second one...
 Right now I show an activity by using :

 Intent i = new Intent(this, activitysName.class);
 startActivity(i);

 I have no idea whilst using this construction how I can initialize
 the new object with the String array I want to pass to it...
 So how should this be achieved ? Should I be using something else
 instead of an Intent-Activity combination ?

Call putExtra() on the Intent after construction to attach the String
array. Call getStringArrayExtra() on the Intent in the receiving Activity
to get it back.

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