Apps Passing data to an activity

sehudson

Newbie
I have seen the idea of passing data to an activity by using putExtra() in the intent. How would I pass an instance of the class, or a component in the class to a new Activity? For instance, I want to call a camera activity from my activity(call it activityA) and after the callback(), I want to set a checkbox in activityA to be checked. how would I pass the checkbox to the camera activity, or can I pass the instance of the class to the camera activity?
 

jonbonazza

Android Expert
I have seen the idea of passing data to an activity by using putExtra() in the intent. How would I pass an instance of the class, or a component in the class to a new Activity? For instance, I want to call a camera activity from my activity(call it activityA) and after the callback(), I want to set a checkbox in activityA to be checked. how would I pass the checkbox to the camera activity, or can I pass the instance of the class to the camera activity?


Intents only allow for transfering primitives (and arrays).

Your best bet for this situation is to simply make a class containing static instances of all of the objects you wish to pass. This would allow you to access them from anywhere in your program.
 

miXer

Android Enthusiast
If i understand you right, you want to start an camera activity from activityA, and when the camera activity returns, you want a checkbox to checked? If so, you should use startActivityForResult and catch the result in onActivityResult
 
Top