Java 类com.google.android.gms.maps.GoogleMap.OnMapLongClickListener 实例源码

项目:map-controller    文件:MapController.java   
/**
 * when map is long clicked
 *
 * @param callback
 */
public void whenMapLongClick(final ClickCallback callback) {
    map.setOnMapLongClickListener(new OnMapLongClickListener() {
        @Override
        public void onMapLongClick(LatLng latLng) {
            callback.clicked(map, latLng);
        }
    });
}
项目:apps_small    文件:MapsActivity.java   
@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    mMap.clear();

    Double lat = Double.parseDouble(latPlace);
    Double lon = Double.parseDouble(longPlace);

    LatLng currentPlace = new LatLng(lat, lon);
    mMap.addMarker(new MarkerOptions()
            .position(currentPlace)
            .title(namePlace)
            .icon(BitmapDescriptorFactory
                    .defaultMarker(BitmapDescriptorFactory
                            .HUE_BLUE)));
    mMap.moveCamera(CameraUpdateFactory.zoomTo(10));
    mMap.moveCamera(CameraUpdateFactory.newLatLng(currentPlace));


    mMap.setOnMapLongClickListener(new OnMapLongClickListener() {


        @Override
        public void onMapLongClick(LatLng arg0) {

            mMap.addMarker(new MarkerOptions()
                    .position(arg0)
                    .title("new location")
                    .icon(BitmapDescriptorFactory
                            .defaultMarker(BitmapDescriptorFactory.HUE_BLUE)));

            Double lati = (arg0.latitude);
            Double loni = (arg0.longitude);
            String aLatPlace = lati.toString();
            String aLongPlace = loni.toString();

            Geocoder myGeo = new Geocoder(getApplicationContext(), Locale.getDefault());

            try {
                List<Address> myAddresses = myGeo.getFromLocation(lati, loni, 1);

                if (myAddresses != null && myAddresses.size() > 0) {

                    // FOR TESTING //Log.i("WJH", myAddresses.get(0).toString());

                    myNewLocal = myAddresses.get(0).getAddressLine(0) + ", "
                            + myAddresses.get(0).getAddressLine(1);

                } else {

                    myNewLocal = "";

                }
            } catch (IOException e) {
                e.printStackTrace();
            }

            Intent returnIntent = getIntent();
            returnIntent.putExtra("anamePlace",myNewLocal);
            returnIntent.putExtra("alatPlace",aLatPlace);
            returnIntent.putExtra("alongPlace",aLongPlace);
            setResult(Activity.RESULT_OK,returnIntent);
            finish();

        }
    });

}
项目:referendum_1o_android    文件:GoogleMapWrapper.java   
@Override
public final void setOnMapLongClickListener(OnMapLongClickListener listener) {
    map.setOnMapLongClickListener(listener);
}
项目:HereAStory-Android    文件:GoogleMapWrapper.java   
@Override
public final void setOnMapLongClickListener(OnMapLongClickListener listener) {
    map.setOnMapLongClickListener(listener);
}
项目:mtransit-for-android    文件:GoogleMapWrapper.java   
@Override
public final void setOnMapLongClickListener(OnMapLongClickListener listener) {
    map.setOnMapLongClickListener(listener);
}
项目:referendum_1o_android    文件:IGoogleMap.java   
void setOnMapLongClickListener(OnMapLongClickListener listener);
项目:HereAStory-Android    文件:IGoogleMap.java   
void setOnMapLongClickListener(OnMapLongClickListener listener);
项目:mtransit-for-android    文件:IGoogleMap.java   
void setOnMapLongClickListener(OnMapLongClickListener listener);