本文整理汇总了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);
}
});
}
示例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();
}
});
}
示例3: setOnMapLongClickListener
import com.google.android.gms.maps.GoogleMap.OnMapLongClickListener; //导入依赖的package包/类
@Override
public final void setOnMapLongClickListener(OnMapLongClickListener listener) {
map.setOnMapLongClickListener(listener);
}
示例4: setOnMapLongClickListener
import com.google.android.gms.maps.GoogleMap.OnMapLongClickListener; //导入依赖的package包/类
@Override
public final void setOnMapLongClickListener(OnMapLongClickListener listener) {
map.setOnMapLongClickListener(listener);
}
示例5: setOnMapLongClickListener
import com.google.android.gms.maps.GoogleMap.OnMapLongClickListener; //导入依赖的package包/类
void setOnMapLongClickListener(OnMapLongClickListener listener);