我是 SD 卡上的一些图像。我还保存了他们的经度和纬度..现在我想在谷歌地图上覆盖所有这些图像作为缩略图..当我点击任何缩略图时,它会移动到下一个活动,以显示全图。我可以只覆盖一张图片……它的代码是这样的……
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.googlemap);
mapView = (MapView) findViewById(R.id.mapView);
mapView.setBuiltInZoomControls(true);
// imm=(ImageView)findViewById(R.id.Google_Img_View);
mapView.setSatellite(true);
b=(Button)findViewById(R.id.googleImageDone);
b.setOnClickListener(this);
Intent i = getIntent();
//Parcelable myParcelableObject = (Parcelable) i.getParcelableExtra("name_of_extra");
bit = (Bitmap) getIntent().getParcelableExtra("Map");
//imm.setImageBitmap(bit);
String id = i.getStringExtra("lon");
String name = i.getStringExtra("long");
// mapView.setTraffic(true);
mc = mapView.getController();
String coordinates[] = {id,name};
double lat = Double.parseDouble(coordinates[0]);
double lng = Double.parseDouble(coordinates[1]);
pp = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));
mc.animateTo(pp);
mc.setZoom(19);
MapOverlay mapOverlay = new MapOverlay();
List<Overlay> listOfOverlays = mapView.getOverlays();
listOfOverlays.clear();
listOfOverlays.add(mapOverlay);
}
private class MapOverlay extends Overlay
{
@Override
public boolean draw(Canvas canvas, MapView mapView,
boolean shadow, long when)
{
super.draw(canvas, mapView, shadow);
Point screenPts = new Point();
//---translate the GeoPoint to screen pixels---
mapView.getProjection().toPixels(pp, screenPts);
//---convert the gif image into bmp
// Bitmap bmp = BitmapFactory.decodeResource(
// getResources(), R.drawable.e);
//---add the marker---
canvas.drawBitmap(bit, screenPts.x, screenPts.y-50, null);
return true;
}
@Override
public boolean onTouchEvent(MotionEvent event, MapView mapView)
{
if (event.getAction() == 1)
{
GeoPoint p = mapView.getProjection().fromPixels(
(int) event.getX(), (int) event.getY());
st1=p.getLatitudeE6() / 1E6+"";
st2=p.getLongitudeE6() /1E6+"";
Toast.makeText(getBaseContext(), "Location: "+
p.getLatitudeE6() / 1E6 + "," + p.getLongitudeE6() /1E6 ,
Toast.LENGTH_SHORT).show();
}
return false;
}
}