0

I am creating one application,in my application I am using json parsing,I am sending request to server for searching

after click on button request will be send,and i will get response

{"searchresult":
  [ {"match_detail_id":369,"profile_id":"GM686317","name":"Sonal Patel","image":"","location":"Rajkot ,Gujarat ,India","mothertongue":"Gujarati","religion":"Hindu","occupation":"Professor \/ Lecturer","education":"Masters - Arts\/ Science\/ Commerce\/ Others"}
  , {"match_detail_id":396,"profile_id":"GM780609","name":"Hetal Trivedi","image":"","location":"Rajkot ,Gujarat ,India","mothertongue":"Gujarati","religion":"Hindu","occupation":"Administrative Professional","education":"Bachelors - Arts\/ Science\/ Commerce\/ Others"}
  , {"match_detail_id":1078,"profile_id":"GM540027","name":"Shruti  Dave","image":"","location":"Rajkot ,Gujarat ,India","mothertongue":"Gujarati","religion":"Hindu","occupation":"Education Professional","education":"Masters - Arts\/ Science\/ Commerce\/ Others"}
  ]
}

I want to show this response in another activity

Cactus
  • 27,075
  • 9
  • 69
  • 149
  • parse this response in your this activity and pass the values in other activity using the bundle or intent and use it there or you can pass the whole json and then parse the values in other activity and use it – Pramod Yadav Dec 09 '14 at 06:26
  • i passed whole json already,but how can i print response there? –  Dec 09 '14 at 06:29
  • you have to parse the values from json to show the values – Pramod Yadav Dec 09 '14 at 06:33
  • yeah but how can i do this? –  Dec 09 '14 at 06:39
  • google some tutorials and on how to parse json on android this will be a good place to start http://www.androidhive.info/2014/09/android-json-parsing-using-volley/ – Pramod Yadav Dec 09 '14 at 06:46
  • i know json parsing bro,but my question different read again –  Dec 09 '14 at 06:47
  • how you want to show it i am unable to understand if you have the values why don't you set it in your edittext – Pramod Yadav Dec 09 '14 at 06:56

2 Answers2

0

Store the response data in a map and pass it to next activity.

hon2a
  • 7,006
  • 5
  • 41
  • 55
Babin
  • 70
  • 1
  • 1
  • 9
0

Parse the response you have received, and store it in a arrayList with the custom object you create to store your each response line.

{"match_detail_id":369,"profile_id":"GM686317","name":"Sonal Patel","image":"","location":"Rajkot ,Gujarat ,India","mothertongue":"Gujarati","religion":"Hindu","occupation":"Professor \/ Lecturer","education":"Masters - Arts\/ Science\/ Commerce\/ Others"}

this is your one line, so object class would be like this -

public class ResultObejct implements parcelable {

    String match_detail_id;
    String profile_id;
    String name;
    String image;

    public String getName(){ //set getter and setters
    return this.name;
...
...
...

}

And Like this link, put your data in intent,

Intent i = new Intent(...);
i.putExtra("data", new DataWrapper(yourArrayList));

and retrieving in next activity:

DataWrapper dw = (DataWrapper) getIntent().getSerializableExtra("data");
ArrayList<Parliament> list = dw.getParliaments();
Community
  • 1
  • 1
Darpan
  • 5,623
  • 3
  • 48
  • 80
  • can you check this question?http://stackoverflow.com/questions/27458980/how-to-send-image-to-next-activity/27459920?noredirect=1#comment43361319_27459920 –  Dec 16 '14 at 04:04