当前位置: 首页>>代码示例>>Java>>正文


Java OnMapLongClickListener类代码示例

本文整理汇总了Java中com.google.android.gms.maps.GoogleMap.OnMapLongClickListener的典型用法代码示例。如果您正苦于以下问题:Java OnMapLongClickListener类的具体用法?Java OnMapLongClickListener怎么用?Java OnMapLongClickListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OnMapLongClickListener类属于com.google.android.gms.maps.GoogleMap包,在下文中一共展示了OnMapLongClickListener类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: whenMapLongClick

import com.google.android.gms.maps.GoogleMap.OnMapLongClickListener; //导入依赖的package包/类
/**
 * 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);
        }
    });
}
 
开发者ID:kewang,项目名称:map-controller,代码行数:14,代码来源:MapController.java

示例2: onMapReady

import com.google.android.gms.maps.GoogleMap.OnMapLongClickListener; //导入依赖的package包/类
@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();

        }
    });

}
 
开发者ID:alaskalinuxuser,项目名称:apps_small,代码行数:69,代码来源:MapsActivity.java

示例3: setOnMapLongClickListener

import com.google.android.gms.maps.GoogleMap.OnMapLongClickListener; //导入依赖的package包/类
@Override
public final void setOnMapLongClickListener(OnMapLongClickListener listener) {
    map.setOnMapLongClickListener(listener);
}
 
开发者ID:mosquitolabs,项目名称:referendum_1o_android,代码行数:5,代码来源:GoogleMapWrapper.java

示例4: setOnMapLongClickListener

import com.google.android.gms.maps.GoogleMap.OnMapLongClickListener; //导入依赖的package包/类
@Override
public final void setOnMapLongClickListener(OnMapLongClickListener listener) {
	map.setOnMapLongClickListener(listener);
}
 
开发者ID:mtransitapps,项目名称:mtransit-for-android,代码行数:5,代码来源:GoogleMapWrapper.java

示例5: setOnMapLongClickListener

import com.google.android.gms.maps.GoogleMap.OnMapLongClickListener; //导入依赖的package包/类
void setOnMapLongClickListener(OnMapLongClickListener listener); 
开发者ID:mosquitolabs,项目名称:referendum_1o_android,代码行数:2,代码来源:IGoogleMap.java


注:本文中的com.google.android.gms.maps.GoogleMap.OnMapLongClickListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。