android - JSONArray weird Output on Different Devices -
hi have following string
[{"subscriberid":"151-52-049","long":"46.69127274","lat":"24.70912743"},{"subscriberid":"151-29-016","long":46.69570000","lat":"24.70770000"}]
i converting string jsonarray
jsonarray jsonarrr = new jsonarray(string);
then looping array , getting jsonobject
for (int h = 0; h < jsonarrr.length(); h++) { jsonobj = jsonarrr.getjsonobject(h); iterator<string> iter = jsonobj.keys(); object valuee = ""; string key = iter.next(); log.e(tag, "key is: " + key); try { valuee = jsonobj.get(key); log.e(tag, "key: " + key + "---value: " + valuee); //on htc key subscriberid , value while on samsung key long , valuee!! } catch (jsonexception e) { log.e(tag,"some error: "+e); }
in loop value retrieved first value in each object. on htc mobile first value displaying correctly value of subscriberid buy on samsung device, first value displaying long.
please appreciated!!
order of keys not defined. if execute code on different devices may see keys in different orders. ref
returns iterator of string names in object. returned iterator supports remove, remove corresponding mapping object. if object modified after iterator returned, iterator's behavior undefined. order of keys undefined.
Comments
Post a Comment