Хочу просто отправить location в класс MyAsyncTask но не понимаю как кто может подсказать пж вот код
private String formatLocation(Location location) {
if (location == null)
return "";
new MyAsyncTask(location).execute();
return String.format(
"Coordinates: lat = %1$.4f, lon = %2$.4f, time = %3$tF %3$tT",
location.getLatitude(), location.getLongitude(), new Date(
location.getTime()));
}
class MyAsyncTask() extends AsyncTask<String, String, String> {
String server = "http://demo.harrix.org/demo0011";
String a, b, answerHTTP;
a = ((Double) location.getLatitude()).toString();
b = ((Double) location.getLatitude()).toString();
@Override
protected String doInBackground(String... params) {
HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet(server + "?a=" + a + "&b=" + b);
try {
HttpResponse response = httpclient.execute(httpget);
if (response.getStatusLine().getStatusCode() == 200) {
HttpEntity entity = response.getEntity();
answerHTTP = EntityUtils.toString(entity);
}
}
catch (ClientProtocolException e) {
}
catch (IOException e) {
}
return null;
}}