• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Passing data to an activity

sehudson

Newbie
Feb 2, 2011
17
0
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?
 
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.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones