I want full JSON data from an API to show in other activity. Tell me how I can do that.
Asked
Active
Viewed 42 times
-2
-
Bad idea. You can use the JSON as a String and pass it to the second activity. – Eyosiyas Mar 22 '21 at 18:13
2 Answers
0
You can not directly pass JSON data to another activity. You can convert the JSON data to String and pass as extra with the inetent to another activity and retrieve the data.
intent.putExtra("JSON_DATA", json_object.toString());
startActivity(intent);
Retrieve data:
try {
json_object = new JSONObject(getIntent().getStringExtra("JSON_DATA"));
} catch (JSONException e) {
e.printStackTrace();
}

Asif A. Sohan
- 202
- 1
- 5
0
using gson you can pass JSON Array data from one activity to another
Reference Url - https://gist.github.com/WrathChaos/5f39e3ce3874a049d25e2ca8958d18b6

axar
- 539
- 2
- 17