Hye guys I am working on the project of vehicle tracking system when user can enters the number of vehicle the the draw a poly line on the vehicles route...
I have stored route locations with their latitude and longitude into mysql database I used asynctask method to fetch this data....
now this is my code in getRoute method
getRoute method will be call on the button click when user enters the number in EditText
public void getRoute()
{
final String BusNo = editBusNo.getText().toString().trim();
Log.i(TAG,"value of the Bus No is "+ BusNo);
class GetRoute extends AsyncTask<Void,Void,String>
{
ProgressDialog loading;
@Override
protected void onPreExecute() {
super.onPreExecute();
Log.i(TAG,"in pre execute");
loading = ProgressDialog.show(MapsActivity.this, "Fetching...", "Wait...", false, false);
}
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
loading.dismiss();
Log.i(TAG,"post execute");
JSON_STRING = s;
Log.i(TAG,"value of json_string "+ JSON_STRING);
}
@Override
protected String doInBackground(Void... params) {
RequestHandler rh = new RequestHandler();
String s = rh.sendGetRequestParam("http://192.168.1.35/projects/map.php?name=", BusNo);
Log.i(TAG,"value of s is "+ s);
//Log.i(T,"The value of s is "+ s);
return s;
}
}
GetRoute gr = new GetRoute();
gr.execute();
}