android - How to get float value from json? -
android - How to get float value from json? -
i retrieving value jsondata
httpclient client = new defaulthttpclient(); httpconnectionparams.setconnectiontimeout(client.getparams(), 10000); httpresponse response; httpget gett = new httpget(url); response = client.execute(get); bufferedreader reader = new bufferedreader(new putstreamreader(response.getentity().getcontent(), "utf-8")); orignalresponse = reader.readline(); jsontokener tokener = new jsontokener(orignalresponse); jsonobject jsondata = new jsonobject(tokener); log.v("amount", "amount :"+jsondata.get("amount"));
i want retrieve "amount" "23868352383.00" while retrieving using
jsondata.get("amount")
, gives value "2.3868352383e10",
using jsondata.getdouble("amount")
, gives value "2.3868352383e10"
using jsondata.getlong("amount")
removes fraction part
how can retrieve value ?? please help.
you can seek big decimal convert string float removing exponents
check it
bigdecimal.valueof(yourvaluestring);
hope help.
you can farther help here thanks
android json web-services double
Comments
Post a Comment