简体   繁体   中英

i need to make a pointer over the MapView,how to do that?

Here is my location with long and lattitudes its working but i need to make pointer over there, is it possible.and also need to know can i write anything to my location on the map, plz any body help me

package com.emigostec;

import android.os.Bundle;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;

public class GmapviewActivity extends MapActivity {
    /** Called when the activity is first created. */
    double lat=17.44764,lon=78.50882;
    GeoPoint gp;
    MapController mc;
    MapView mv;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mv=(MapView)findViewById(R.id.mapView);
        gp=new GeoPoint((int)(lat*1000000),(int)(lon*1000000));
        mc=mv.getController();
        mc.setCenter(gp);
        mc.setZoom(25);
        mv.setSatellite(true);
    }

    @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }
}

It's not exactly solution for you, but if you get source code from this http://www.hrupin.com/2011/10/how-to-implement-lazy-loading-for-markers-on-google-maps-in-android and this http://www.hrupin.com/2011/11/how-to-centering-google-map-on-balloon-center-in-android you can create a perfect solution.

Hope, it help you!

An overlay can be used to display anything on top of the map. You can write your own overlay to do that or simply use the com.google.android.maps.MyLocationOverlay to draw your current location marker.

See eg http://joshclemm.com/blog/?p=148 for a simple example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM