android - Parsing multiple json object value leading in last value of that object. -


I am working on an app, where I am getting a response from a remote server. I am also able to parse and place marker on the basis of that reaction. But I have failed to parse pH data from feedback and passing it in any other activity.

This is sending the phone number of the last json object data in the setOnInfoWindowClickListener event.

I know some minor modifications I have made to. Please give me a suggestion in this.

This Jason reaction is getting me. "Abcdef", point: "77.588018,12.959282"}, {{id: 965, distance: "1.47", pH: "33441111", name: "XYZ", { ID: 965, Distance: "1.47", Ph: "33,441,111", Name: "XYZ", RAS: "abcdef", point: "77.588018,12.959282"},. . ]

I tried this type of parse

  AsyncTask the private class HttpGetTask & lt extends zero, zero, string & gt; {// progress dialog show // URL @ Override protected string DoInBackground (zero ... parameter) {// http stuff} @Override secure zero Postaksaktek (string result) {if (pDialog.isShowing ()) pDialog.dismiss ( ); Try {JSONArray json = new JSONArray (results); For (int i = 0; i & lt; json.length (); i ++) {log. V ("response", result); Last JSONObject e = json.getJSONObject (i); String point = eeststring ("dot"); Last string phone = E.getstring ("pH"); String [] point2 = point.split (","); Double Room 1 = Double. PRSDABL (Point 2 [0]); Double LNG 1 = Double. PRSDABL (Point 2 [1]); Gmark.addMarker (New MarkerOptions) .title (e.getString ("name")) .snippet (e.getString ("Lok Sabha") + "*" + e.getString ("pH"). Position (New LatLng (LNG 1, lat 1) .con (bitmap descriptor format from resource (RDRA.PMR))); GMapksetInfoWindowAdapter (New InfoWindowAdapter () {@Override public view GetInfoWindow (marker arg0) {// TODO Auto-generated method stub return null;} @ Override public getInfoContents (see marker mrkr) {// TODO Auto-generated method stub string Name = mrkr.getTitle (); String description = mrkr.getSnippet (); String trimmid dipet = extension. Substring (0, 60); Log.v ("info", name + "" + description); v = getLayoutInflater ( See) .inflat (R.layout.fow indow, tap); textview title = (textview) v. Fandvubi ID (RaidTitleTV); TextView snippet = (TextView) v. FandVUBIID (RIDNPTV); title.Stext ("+ +"); snippet.set text ( "+ trim reported went Dipet); return v;}}}); Gmap.setOnInfoWindowClickListener (new OnInfoWindowClickListener () {@Override public void onInfoWindowClick (marker arg0) {intent myIntent = new intent (getBaseContext (), DtActivity.class ); MyIntent.putExtra ("title", arg0.getTitle ()); myIntent .putExtra ("extension", arg0.getSnippet ()); MyIntent.putExtra ("PH1", phone) ;. // and how to send a pH here {string pH = e.getString ("pH"); myIntent Kprostatro ( "PH" pH);} catch (Jesnaksapshn e) {/ TODO Auto-generated catch block Ikprintstakstres ();} Prarnbwykti (Meriinntent);}}); }} Grip (JasonXExpress E) {// Todo Auto-Generated Catch Block e.printStackTrace (); } If (empty! = MClient) mClient.close (); }}    

You need to start the gMap Globaly and add the marker to the loop is . Remove the adapter and infindova click listener code from the form loop and paste it out Please check the sample below.

  Example of public class Fragment activity decrements onInfoundOldList {public static GoogleMap mMap; @ Override Protected Zero (Bundle Saved Instantstate) {Super. NET (Saved Instantstate); SetContentView (R.layout.mapview); MMap = (SupportMapFragment) getSupportFragmentManager () .findFragmentById (R.id.map)). getMap (); MMap.setOnInfoWindowClickListener (this); // loop mMap.addMarker inside (New MarkerOptions (.) Title (e.getString ("name")) .snippet (e.getString ("Lok Sabha") + "*" + e.getString ("pH")). Text (New Latlag (lng1, lat1) .con (bitmap descriptor fororfrom from resource (RDRA.PMR))); // close the loop} @InfoWindowClick (marker marker) {// Override public zero, here you can get the title, snippet, latitude, LN of the selected marker. You can start // activity}   

}

Please paste your loop into the Asyncache class onPostExecute.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -