I have an application that needs to download JSON from URL using AsyncTask and on onPostExecute() pass that JSON Object to next Activity using putExtra method, but I\'m cons
You should pass a serializable or parcelable object through putExtra, as JSONObject is neither serializable nor parcelable object, and so you cant pass it through putExtra.
So you need to make either a Parcelable or Serializable class from parsing a JSONObject, then you can use putExtra method to pass it.
The other option is pass JSON String from jsonOjbect.
In the Activity in which You are getting the JSON data write the following code to send to the TAB activity
Intent i = new Intent(getApplicationContext(), Another_Activity.class);
i.putExtra("key", jsonObject.toString());
startActivity(i);
to access the data ie JSON object Write the following code in tab Activity
JSONObject jsonObject = new JSONObject(getIntent().getStringExtra("key"));
Toast.makeText(Another_Activity.this, ""+jsonObject.get("Your JSON VALUE"), Toast.LENGTH_SHORT).show();
Your JSON VALUE is the filed which is present in the data. eg "Business Id" 1 here business id is the JSON value ,replace it with yours
Do this when passing the param:
intent.putExtra("json", jsonobj.toString());
And in your new activity parse it like so:
JSONObject obj = new JSONObject(getIntent().getStringExtra("json"));