I have one web service in which there are nested object and array, I have parsed the data in one activity, however I want to display the data in two different activity , how can I implement this?
Asked
Active
Viewed 92 times
0
-
If it's not too big a bit of JSON, you can store it in a sharedPreference as a String in the first activity and parse it in the second activity. Wouldn't recommend for large JSON files/strings though... – iaindownie Oct 20 '20 at 16:35
-
Okay, can you suggest any example from google, or share any link of that? – shrutika Oct 21 '20 at 05:42
-
This SO post (https://stackoverflow.com/a/12074219/959481) explains how to add and retrieve strings from sharedPrefs. After downloading the JSON, store the response in ActivityA, and when opening ActivityB, retrieve? – iaindownie Oct 21 '20 at 08:49
-
I've posted this as an answer. If it works for you, accept it and others will know it's helpful. – iaindownie Oct 22 '20 at 11:02
1 Answers
0
This SO post (Storing/retrieving strings with shared preferences) explains how to add and retrieve strings from sharedPrefs. After downloading the JSON in your web service, store the response in ActivityA, and when opening ActivityB, retrieve and parse the JSON using a method common to both activities.

iaindownie
- 1,046
- 12
- 28