passing JSON object to another activity on list item click

前端 未结 3 997
长发绾君心
长发绾君心 2021-01-28 18:02

I have a scenario here,i want to pass the desired json object on the list item click in my below activity

\"activity

3条回答
  •  花落未央
    2021-01-28 18:24

    I know its too late to post this answere but your question is ranking on no.1 position in google search engine, so if someone hasn't find the solution then might be my answere help them. For passing json data to another activity according to Listview position:

    Do this inside OnItemClick you need to copy this code:

    JSONObject SelectedItem=(yourjsonresponse).getJsonObject(position);

    and same as for JSONArray.

    then pass SelectedItem.toString in your Intent.

    Note : yourjsonresponse is your Main API Response that can be jsonobject or jsonarray.

    Thank you

提交回复
热议问题