android - Extract value of a particular key from java hashmap -


I'm a postal calls and got the response he is:

  { "atoken": "32ab3a8738a4b57165b5fc863af4f4c95198c2c9", "utoken": "9a3682e9eac186d56b230d075e7dc0d784992231"}   

POST call is being used code to:

  try {// a new hTTP client and post header hTTP client httpclient = new DefaultHttpClient (); Http post httpPost3 = new HTTP post ("http://www.mywebsite.com/adkh.json"); Logs. I ("inside tokenspost", "inside tokenpost"); & Lt; NameValuePair & gt; nameValuePair = new ArrayList & lt; NameValuePair & gt; (3); NameValuePair.add (new binarynamewallpayer ("mobile", "989876556789")); NameValuePair.add (new bassnamename Pair ("IMEI", "911239987651238")); NameValuePair.add (New BasicNameValuePair ("Focon", mtokenno)); // try {httpPost3.setEntity (new UrlEncodedFormEntity (nameValuePair)); } Hold (unsupported encoding exception e) {// login error log e.printstaxtrace (); } // // executed HTTP post request {try HTPRS response = httpclient.execute (httpPost3); Logs. I ("Response from HTTP post requests", "Response from HTTP post request:" + response); System.out.println ("response:" + response.toString ()); Logs. I ("Starting a Buffettder", "Starting a Battery Card"); Bufferreader Reader = New buffed reader (new interstitial reader). Antita (). GetContent (), "UTF-8"); Stringbuilder builder = new stringbiller (); (Line = zero; (line = reader. Readline ())! = Null;) {builder.append (line) .append ("\ n"); Println (line);   

I am converting responses to the above code from Java code:

  class NaturalDeserializer implementation of JsonDeserializer & lt; Object & gt; {Public Object deserialize (JsonElement json, Type Type OT, JasonDisialisation Contact Reference) {If (json.isJsonNull ()) empty return; Else if (json.isJsonPrimitive ()) handle initial (json.getAsJsonPrimitive ()); else if (json.isJsonArray ()) return Handlarere (json.getAsJsonArray (), reference); And then back to the handle object (json.getAsJsonObject (), context); } Private Object Handel Primitive (JSN Primateated JSN) {if (jsn.isbolin ()) jsn.geta.bone (); Else if (json.isString ()) back to json.getAsString (); Else {BigDekell Hardentek = json.getAsBigDecimal (); // Find out that this is an integer type {bigDec.toBigIntegerExact (); Try {return bigDec.intValueExact (); } Hold (arithmetic exception E) {} return bigDec.longValue (); } Hold (ArithmeticException E) {} // just return it as a double return bigDec.doubleValue (); }} Private Object Handel (Jason Array Jason, JasonDesignisation Contact Reference) {Object [] array = new object [Jason. Size ()] ;; For (Int i = 0; I   

Java hash that I have:

  {atoken = 32ab3a8738a4b57165b5fc863af4f4c95198c2c9, utoken = 9a3682e9eac186d56b230d075e7dc0d784992231}   

now, http://www.website.com/khgt

  curl --data "; lat = 26.850307 & amp LNG = 80.916853 utoken = 7d02a59410722737566f33879dcd061d5f45bc5a & amp": I To post a call you need to code>  

for which I should be the value of UTIN, I am not sure how to remove the value of the utop. Can anyone help you?

If you have a hashmap, you should be able to use just to recover tokens :

  string utoken = map.get ("utoken");    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -