When you have latitude and longitude then use this code
if(!TextUtils.isEmpty(checklat) && !TextUtils.isEmpty(checklon)){
new Mybitmap().execute();
}
public class Mybitmap extends AsyncTask<Void, Void, Bitmap>{
@Override
protected Bitmap doInBackground(Void... params) {
// TODO Auto-generated method stub
abc = imgloader.getBitmap(checkimg);
return abc;
}
@Override
protected void onPostExecute(
Bitmap result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
try{
if(result != null){
final LatLng latlong = new LatLng((Double.parseDouble(checklat)), (Double.parseDouble(checklon)));
Log.i(tag, "Latitude and Longitude ...."+latlong);
map.addMarker(new MarkerOptions()
.position(latlong)
.title(checktitle + " " +checksdateformate).icon(BitmapDescriptorFactory.fromBitmap(result)));
map.moveCamera(CameraUpdateFactory.newLatLngZoom(latlong, 20));
map.animateCamera(CameraUpdateFactory.zoomTo(20), 2000, null);
}}
catch(Exception e){
e.printStackTrace();
}
}
};
if(!TextUtils.isEmpty(checklat) && !TextUtils.isEmpty(checklon)){
new Mybitmap().execute();
}
public class Mybitmap extends AsyncTask<Void, Void, Bitmap>{
@Override
protected Bitmap doInBackground(Void... params) {
// TODO Auto-generated method stub
abc = imgloader.getBitmap(checkimg);
return abc;
}
@Override
protected void onPostExecute(
Bitmap result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
try{
if(result != null){
final LatLng latlong = new LatLng((Double.parseDouble(checklat)), (Double.parseDouble(checklon)));
Log.i(tag, "Latitude and Longitude ...."+latlong);
map.addMarker(new MarkerOptions()
.position(latlong)
.title(checktitle + " " +checksdateformate).icon(BitmapDescriptorFactory.fromBitmap(result)));
map.moveCamera(CameraUpdateFactory.newLatLngZoom(latlong, 20));
map.animateCamera(CameraUpdateFactory.zoomTo(20), 2000, null);
}}
catch(Exception e){
e.printStackTrace();
}
}
};
No comments:
Post a Comment
Comments