For an app I am developing, I am having the user input some information on one activity, and then on the next, the user will read something, in such that he/she won't be putting any information on it, but on the third activity, I want to display what the user put in the first. Is there a way I can carry that information from the 1st to the 3rd activity without going through the second?
Asked
Active
Viewed 62 times
-1
-
You didn't google it well. See this http://stackoverflow.com/questions/5265913/how-to-use-putextra-and-getextra-for-string-data – Nabin Aug 10 '14 at 02:04
-
You can use putExtra() to send something and getExtra to receive from another activity – Nabin Aug 10 '14 at 02:05
-
Thank you everyone for your answers. I will try them all out! Thank you all again. – JCMcRae Aug 12 '14 at 23:01
3 Answers
1
Use sharedPreferences to store that piece of data on the phone. On the 3rd activity, read it and use it. See it here- http://developer.android.com/guide/topics/data/data-storage.html#pref

Neeraj Shukla
- 1,271
- 11
- 13
0
This can be done in many ways !
Why not use Intents to pass the data ?
STEP-1: <Eg:: From Activity1>
Pass the telefone
into a new activity with the help of intents
Intent i = new Intent(getApplicationContext(), Activity2.class);
i.putExtra("title",telefone);
i.putExtra("descrip",telefone);
startActivity(i);
STEP-2: <Eg:: From Activity2>
Receive the string passed in another activity
Bundle extras = getIntent().getExtras();
if (extras != null) {
String title= extras.getString("title");
String descrip= extras.getString("descrip");
}
STEP-3: <Eg:: From Activity2> pass data again to Activity3
Receive the string passed in another activity
Bundle extras = getIntent().getExtras();
if (extras != null) {
String title= extras.getString("title");
String descrip= extras.getString("descrip");
}
Pass the data to Activity3
Intent i = new Intent(getApplicationContext(), Activity3.class);
i.putExtra("title",telefone);
i.putExtra("descrip",telefone);
startActivity(i);
Hope it helps ! ..........Let me know if you need more info

Devrath
- 42,072
- 54
- 195
- 297
0
Use SharedPreference. Save in A1 and retrieve in A3.
Initialization
SharedPreferences pref = getApplicationContext().getSharedPreferences("MyPref", 0); // 0 - for private mode
Editor editor = pref.edit();
Storing Data
editor.putBoolean("key_name", true); // Storing boolean - true/false
editor.putString("key_name", "string value"); // Storing string
editor.putInt("key_name", "int value"); // Storing integer
editor.putFloat("key_name", "float value"); // Storing float
editor.putLong("key_name", "long value"); // Storing long
editor.commit(); // commit changes
Retrieving Data
// returns stored preference value
// If value is not present return second param value - In this case null
pref.getString("key_name", null); // getting String
pref.getInt("key_name", null); // getting Integer
pref.getFloat("key_name", null); // getting Float
pref.getLong("key_name", null); // getting Long
pref.getBoolean("key_name", null); // getting boolean
Deleting Data
editor.remove("name"); // will delete key name
editor.remove("email"); // will delete key email
editor.commit(); // commit changes
Clearing Storage
editor.clear();
editor.commit(); // commit changes

fida1989
- 3,234
- 1
- 27
- 30