app/src/main/java/com/example/bs206/retrofittest/java/a/MapsActivity.java
// Parsing the data in non-ui thread
Parsing the data in non-ui thread
Parsing the data in non - ui thread
@Override
        protected List<List<HashMap<String, String>>> doInBackground(String... jsonData)
        {
            JSONObject jObject;
            List<List<HashMap<String, String>>> routes = null;
            try
            {
                jObject = new JSONObject(jsonData[0]);
                Log.d("ParserTask", jsonData[0].toString());
                DataParser parser = new DataParser();
                Log.d("ParserTask", parser.toString());
                routes = parser.parse(jObject);
                Log.d("ParserTask", "Executing routes");
                Log.d("ParserTask", routes.toString());
            }
            catch (Exception e)
            {
                Log.d("ParserTask", e.toString());
                e.printStackTrace();
            }
            return routes;
        }
@ Override protected List < List < HashMap < String , String > > > doInBackground ( String ... jsonData ) { JSONObject jObject ; List < List < HashMap < String , String > > > routes = null ; try { jObject = new JSONObject ( jsonData [ 0 ] ) ; Log . d ( "ParserTask" , jsonData [ 0 ] . toString ( ) ) ; DataParser parser = new DataParser ( ) ; Log . d ( "ParserTask" , parser . toString ( ) ) ; routes = parser . parse ( jObject ) ; Log . d ( "ParserTask" , "Executing routes" ) ; Log . d ( "ParserTask" , routes . toString ( ) ) ; } catch ( Exception e ) { Log . d ( "ParserTask" , e . toString ( ) ) ; e . printStackTrace ( ) ; } return routes ; }
Parsing the data in non-ui thread
Parsing the data in non - ui thread
// Starts parsing data