Saturday 15 August 2015

android - How to separate JsonArray data -


I was confused how to separate the JsonArray data I separated the received chat messages I do not want to be able to create a big bubble in each bubble one by one
What should I do to isolate the data from each other? Can someone help me? Thank you in advance.

My Jason piece of code:

  if (! Content.equals ("null")) {try {JSONArray jArr = new JSONArray (content); String message = ""; For (int i = 0; i & lt; jArr.length (); i ++) {JSONObject jObj = jArr.getJSONObject (i); String Message = jObj.getString ("message"); Message + = Message + "\ n"; } ShowMessage (message, incorrect); } Grip (JasonAxpection E) {// Two-Auto Auto-Generated Cat Block E.Pintstaxtres (); }} And (toast.maketext.a, "error", toast.LnnHH_LOG) Show ();}   

Logcat:

06 -22 09: 15: 20.486: D / ADBUG (51 9): Content: [{"First name": "teach", "message": "test"}, {"firstname": "teach", "message": {"Firstname": "teach", "message": "test"}, {"firstname", "message": "message": "test", {"first name": "teach" {"First name": "teach", "message": "teach", " First name ":" Teach "," Message ":" DDFFS "},

I want to create my data like this:
 Enter image details here

one Change the line like this:

  for string message = ""; (int i = 0; i & lt; jArr.length (); i ++) {JSONObject jObj = jArr. GetJSONObject (i); String Message = jObj.getString ("message"); ShowMessage (Message, False); // Take it here but not outside for 'for')    

No comments:

Post a Comment