-2

I want full JSON data from an API to show in other activity. Tell me how I can do that.

2 Answers2

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