Skip to content Skip to sidebar Skip to footer

Passing Values Between Activities In Android

I have a question about passing data between activities in Android. I tried to make an object Parcelable, it works but it's complicated to implement for every class. I want to try

Solution 1:

I have a strong feeling that we misunderstand the whole conception of Activities. Looking at the intent's extra mechanism of passing data I can say Activity was invented like something all-sufficient w/o need of exchanging large amount of data between each other. But I still havn't got a point of android core designers. Check this thread, mb you'll find it helpfull.

Solution 2:

SharedPreferences is a global store accessible to all activities

http://developer.android.com/reference/android/content/SharedPreferences.html

... but as a key/value store it is no more capable than intent extras.

Solution 3:

I have had success using a util class to hold private static objects that I need to pass around to other Activities within a single application. Don't be afraid to try it.

Post a Comment for "Passing Values Between Activities In Android"