Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't Google map show specific point on Android?

I am using this code. My problem is that it is not showing the point which is displayed in maps.google.com. I am using Google API for 2.1. I am following this Google map link Check out the difference. You will notice in top left corner of garden.

enter image description here

Here my code is

package com.my.test;


public class MapsActivity extends MapActivity {

MapView mapView; 
MapController mc;
GeoPoint p;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mapView = (MapView) findViewById(R.id.mapView);
    LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);  
    View zoomView = mapView.getZoomControls(); 

    zoomLayout.addView(zoomView, 
        new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, 
            LayoutParams.WRAP_CONTENT)); 
    mapView.displayZoomControls(true);

    mc = mapView.getController();
    String coordinates[] = {"-6.23", "106.83"};
    double lat = Double.parseDouble(coordinates[0]);
    double lng = Double.parseDouble(coordinates[1]);

    p = new GeoPoint(
        (int) (lat * 1E6), 
        (int) (lng * 1E6));

    mc.animateTo(p);
    mc.setZoom(17); 
    mapView.invalidate();
}

@Override
protected boolean isRouteDisplayed() {
    return false;
}

}

like image 951
Arslan Anwar Avatar asked Apr 20 '26 12:04

Arslan Anwar


1 Answers

You can get the example here.

Its a very good link.

like image 198
Sandy Avatar answered Apr 23 '26 01:04

Sandy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!