[android-developers] Re: really easy question... but not for me =P
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 elk...@gmail.com 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 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: really easy question... but not for me =P
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 vladimir.funti...@gmail.com 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 elk...@gmail.com 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 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: really easy question... but not for me =P
So are you talking about like a Setup activity, where you choose those things, and then when you're done it launches the game? If that's what you're talking about, you would create the second activity and pass the config options to it at creation. http://developer.android.com/intl/zh-CN/reference/android/app/Activity.html On Mar 2, 2:21 pm, Kofa elk...@gmail.com 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 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