I wants to know if there are any other ways to pass data from one Activity to another Activity without using bundle(Intent), Sharedpreference and database(SQLITE). If there are any other way,please suggest me those.
Asked
Active
Viewed 95 times
-1
-
use the static variable which you can share to any activity – Maheshwar Ligade May 12 '16 at 10:42
-
Intent should **always** be your preferred way. If you describe what you are trying to achieve, we can look for the best solution for your case. – natario May 12 '16 at 10:44
-
What's wrong with the options you've listed? – Mike M. May 12 '16 at 10:44
-
Explain what you want to do in order to know the best way – Jofre Mateu May 12 '16 at 10:44
-
actually this question was asked to me in an interview. So i was very much eager to know the other ways to pass data from one activity to another – Manish Singh Rana May 12 '16 at 10:48
2 Answers
0
You could pass data between activities via:
- Extras bundle while starting new activity;
- Result bundle if you're using startActivityForResult;
- Broadcast receivers.
All of the methods above are using Intents. If you want to avoid Intents usage (you shouldn't), as a alternative look at event busses (EventBus, Otto etc.) Also please keep in mind that Database and SharedPreferences haven't designed for such purposes. Instead of this you could use them as a long-term storage.

Stas Lelyuk
- 538
- 6
- 19
0
Options for storing data in android :
- Using Intents
- Using Bundle
- Using Shared Preferences
- Using files
- Using SQLite
- Using Server
If you need to pass small data(ex. string) use intents. For big data you should go for SQLite or Server. If you need to retain small data throughout the app, use shared preferences.

Sharad Chauhan
- 4,821
- 2
- 25
- 50