U can use bundle also in passing that variable values.....
In 1st activity
Bundle bundle = new Bundle();
bundle.putString(”param1″, “test”);
Intent newIntent = new Intent(this.getApplicationContext(),
ActivityClass2.class);
newIntent.putExtras(bundle);
startActivity(newIntent);
In ActivityClass2, we can read this parameter using
Bundle bundle = this.getIntent().getExtras();
String param1 = bundle.getString(”param1″);
On Mar 3, 2:31 pm, Vladimir <[email protected]> wrote:
> Use intent.putExtra(key, value) in your 1st activity and access them
> using getIntent().getExtras() in the 2nd
>
> On Mar 3, 12:21 am, Kofa <[email protected]> wrote:
>
> > I'm trying to read a variable from one activity to another... i
> > explain better: I'm making a video game, so the user will have to
> > chose like a team, color, and other options from one activity and then
> > should read this variables from another activity.
> > so the question is... how can i declare integer, string, etc values
> > from one activity and then read it from another activity? thx a lot
>
>
--
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