java - parsing a specific JSON data format -
I have a small problem, I'm building an Android application, one. A php file is used to call a Java script file which gives me a JSON output. Now my problem is that the output is in a valid JSON format, now I am confused as a way to parse values . Output is
["15.493511", "73.818659"]
Where the first value is the latitude value and the second is the latitude value .. what i want to do I am pars, it is on bringing this value into asynctask, I want to divide these values, they should allocate these variables. Any idea how I could do this. Thank you in advance.
Do something like the following,
MyAsyncTask to Personal Class AsyncTask Increases & lt; String, string, string & gt; {@Override Secure Zero on PreExecute () {super.onPreExecute (); } @ Override protected string doInBackground (string ... parameter) {string data = "[" 15.493511 "," 73.818659 "]"; // Assume this is your static data {JSONArray myArray = New JSONArray (data); String latitudes = myArray.getString (0); String lateetid = myArray.getString (1); }} Grip (JasonXExpress E) {// Todo Auto-Generated Catch Block e.printStackTrace (); } Return tap; } @Override Secure Zero PostExecute (string result) {super.onPostExecute (Results); // Update your UI or do your work; }}}
and
AsyncTask execute as the following,
new MyAsyncTask (). carry about ();
Comments
Post a Comment