my android asynctask crashes when button is clicked.Here is the code below
/** private class GetAddressTask extends AsyncTask{ Context mContext; * public GetAddressTask(Context context) { * super(); * mContext = context;}
*@Override * protected LatLng doInBackground(String... params){ * Geocoder gc = new Geocoder(mContext); * List addresses = null; * try { * /* * * Return 1 address. * */ * String location = edit.getText().toString(); * addresses = gc.getFromLocationName(location, 1);}
- catch (IOException e1) {
- Log.e("LocationSampleActivity",
- "IO Exception in getFromLocation()");
e1.printStackTrace();}
catch (IllegalArgumentException e2) {
e2.printStackTrace();}
if (addresses != null && addresses.size() > 0) {
Address address = addresses.get(0);
- double lat = address.getLatitude();
double lng = address.getLongitude();
LatLng mint = new LatLng(lat,lng);
return mint;
}
else {
- return null;
}
}
@Override
- protected void onPostExecute (LatLng mint) {
- CameraUpdate update = CameraUpdateFactory.newLatLngZoom(mint,14);
map.moveCamera(update);
progress.dismiss();
- } */ .PLEASE I BEG,PARDON THE ERROR MARKERS,AM AND I DONT KNOW HOW TO IDENT
0 comments:
Post a Comment