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

2010-02-11 Thread MobDev
Call getStringArrayExtra() on the Intent in the receiving Activity
to get it back. 

I have no Intent in the receiving Activity ? Or is that the Bundle
which comes with public void onCreate(Bundle savedInstanceState) ?

On 11 feb, 13:46, Mark Murphy mmur...@commonsware.com wrote:
  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


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

2010-02-11 Thread Mark Murphy

 Call getStringArrayExtra() on the Intent in the receiving Activity
 to get it back. 

 I have no Intent in the receiving Activity ?

Call getIntent() to get the Intent that launched the Activity.

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


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

2010-02-11 Thread MobDev
aha !
look at that ! thanks a lot for the answer it helped me out :D
I have to say that It's all pretty confusing,
you got your Java class, your XML layout, your activity, your Intent,
your Context, your bundles etc...
Inter-object communication isn't very easy (or at least not as
transparant as in J2ME), just passign a reference and using its get/
set methods or whatever...
Well I did get your book (together with other 4 books!), and after
this first hacked demo for our app I will be investing much more time
into this complex hierarchy of classes and methologies...

On 11 feb, 14:10, Mark Murphy mmur...@commonsware.com wrote:
  Call getStringArrayExtra() on the Intent in the receiving Activity
  to get it back. 

  I have no Intent in the receiving Activity ?

 Call getIntent() to get the Intent that launched the Activity.

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