How to pass JSON Object to new activity

前端 未结 3 748
太阳男子
太阳男子 2020-12-10 17:58

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

3条回答
  •  盖世英雄少女心
    2020-12-10 18:13

    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.

提交回复
热议问题