How to pass JSON Object to new activity

前端 未结 3 744
太阳男子
太阳男子 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:24

    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"));
    

提交回复
热议问题