How to pass a variable to a new activity via intent ?

by Emre A. Yavuz » Thu, 17 Sep 2009 06:43:54 GMT

Sponsored Links


I'd like to pass a variable to a new activity which I start using an Intent. I 
know that I need to use the putExtra() method on the intent which I create in 
the old Activity. I also know that I need to use the getIntExtra() method 
(assuming that the variable I am trying to pass is an Integer) to grab it in 
the new Activity.


Here comes the problem;


I have to call the method getIntExtra() on an Intent in the new Activity, yet I 
am not sure what that Intent would be. How can I get a hold of the Intent which 
I created in the old Activity ? Any suggestions ?


Thanks in advance,


With regards,



New! Faster Messenger access on the new MSN homepage 

Other Threads

1. Not calling OnStop when an incoming call is received

Bob may be referring to bumping the volume rocker while something is
playing that will respond to that rocker.

That being said, the current volume control API seems skewed towards
helping apps that are trying to make persistent changes to the volume. I
can envision a class of apps -- games, for example -- that might need a
transient change to the volume, solely while their app is running.
Having something in the framework that would support that, so apps don't
accidentally{*filter*}up the volume due to coding bugs, might be handy.

Mark Murphy (a Commons Guy)
 http://www.***.com/  |  http://www.***.com/ 
 http://www.***.com/ |  http://www.***.com/ 

Android Training...At Your Office:  http://www.***.com/ 


2. Prevent scaling of :button on checkbox?

I have a custom checkbox which I assign a custom resource to using the
android:button attribute. My problem is that it scales it too large
and seems to ignore android:scaleType. Does anyone know what's going


3. Not calling OnStop when an incoming call is received

4. Activity receiving messages after onDestroy

5. Different screen sizes x different layouts

6. onLocationChanged - differences between emulator 1.5 and emulator 2.1

7. Help With Drawable.getPadding ?