GoogleMap setOnMarkerDragListener - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for GoogleMap setOnMarkerDragListener method.

This code example shows how to use the following methods:addMarker, animateCamera, setOnMarkerClickListener, setOnMarkerDragListener
/* 
 * Copyright (C) 2012 The Android Open Source Project 
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0 
 * 
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License. 
 */ 
 
package com.example.mapdemo; 
 
import com.google.android.gms.maps.CameraUpdateFactory; 
import com.google.android.gms.maps.GoogleMap; 

6
CodeRank
This code example shows how to use the following methods:addPolygon, setMyLocationEnabled, setOnCameraChangeListener, setOnMapClickListener, setOnMapLongClickListener
		} 
		 
	} 
	 
	private void setUpMap() { 
		mMap.setOnMapClickListener(this);
		mMap.setOnMapLongClickListener(this);
		mMap.setOnCameraChangeListener(this);
		mMap.setOnMarkerDragListener(this);
		mMap.setOnMarkerClickListener(this);
		mMap.setMyLocationEnabled(true); //shows the location button and enables it	
		options.add(new LatLng(0,0));
		poly = mMap.addPolygon(options
				.strokeWidth(2)
                .strokeColor(Color.BLACK)
                .fillColor(0x7FB5B1E0));
	} 
	@Override 
    protected void onPause() { 
        super.onPause(); 
6
CodeRank
This code example shows how to use the following methods:addMarker, animateCamera, setOnMarkerClickListener, setOnMarkerDragListener, aW
/* 
 * Copyright (C) 2012 The Android Open Source Project 
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0 
 * 
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License. 
 */ 
 
package com.maptest; 
 
import com.google.android.gms.maps.CameraUpdateFactory; 
import com.google.android.gms.maps.GoogleMap; 

6
CodeRank
This code example shows how to use the following methods:setMyLocationEnabled, setOnMapClickListener, setOnMarkerClickListener, setOnMarkerDragListener
		// Map 
		if (mMap == null && mapFragment != null) {
			mMap = mapFragment.getMap();
 
			// Location 
			mMap.setMyLocationEnabled(true);
 
			// Listeners 
			mMap.setOnMapClickListener(this);
			mMap.setOnMarkerClickListener(this);
			mMap.setOnMarkerDragListener(this);
		} 
 
	} 
 
	// ************************************************ // 
	// **************** OVERRIDE BUSINESS ************* // 
	// ************************************************ // 
 
	/* ****************** OnMapClickListener ******************** */ 
5
CodeRank
This code example shows how to use the following methods:setOnInfoWindowClickListener, setOnMarkerClickListener, setOnMarkerDragListener
		} 
	} 
	 
	public void setGoogleMap(GoogleMap map){
		this.mGoogleMap = map;
		mGoogleMap.setOnInfoWindowClickListener(this);
		mGoogleMap.setOnMarkerClickListener(this);
		mGoogleMap.setOnMarkerDragListener(this);
	} 
	 
	public void setOnInfoWindowClickListener(SupportOnInfoWindowClickListener listener){
		this.mInfoWindowClickListener = listener;
	} 
	 
	public void setOnMarkerClickListener(SupportOnMarkerClickListener listener){
		mMarkerClickListener = listener;
	} 
	 
	public void setOnMarkerDragListener(SupportOnMarkerDragListener listener){
		mMarkerDragListener = listener;
6
CodeRank
This code example shows how to use the following methods:addMarker, animateCamera, setOnMarkerClickListener, setOnMarkerDragListener
        private void setUpMap() { 
            MarkerOptions markerOptions = new MarkerOptions()
                .position(mMarkerPosition)
                .icon(BitmapDescriptorFactory.defaultMarker(mMarkerInfo.mHue))
                .draggable(true);
            mMap.addMarker(markerOptions);
            mMap.setOnMarkerDragListener(this);
            mMap.setOnMarkerClickListener(this);
 
            if (mMoveCameraToMarker) {
                mMap.animateCamera(CameraUpdateFactory.newLatLng(mMarkerPosition));
            } 
        } 
 
        @Override 
        public void onMarkerDragStart(Marker marker) {}
 
        @Override 
        public void onMarkerDrag(Marker marker) {}
 
5
CodeRank
This code example shows how to use the following methods:setOnMarkerDragListener
		map.setOnMarkerClickListener(listener);
	} 
 
	@Override 
	public final void setOnMarkerDragListener(OnMarkerDragListener listener) {
		map.setOnMarkerDragListener(listener);
	} 
 
	@Override 
	public void setOnMyLocationButtonClickListener(OnMyLocationButtonClickListener listener) {
		map.setOnMyLocationButtonClickListener(listener);
	} 
 
	@Override 
	public final void setOnMyLocationChangeListener(OnMyLocationChangeListener listener) {
		map.setOnMyLocationChangeListener(listener);
	} 
 
	@Override 
	public void setPadding(int left, int top, int right, int bottom) {
4
CodeRank
This code example shows how to use the following methods:setOnMarkerDragListener
			} 
		}); 
	} 
 
	private void setMarkerDragListener(GoogleMap map) {
		map.setOnMarkerDragListener(new OnMarkerDragListener() {
			@Override 
			public void onMarkerDragStart(Marker marker) {
				updateInfo("drag start", marker);
			} 
 
			@Override 
			public void onMarkerDrag(Marker marker) {
				LatLng p = marker.getPosition();
				updateInfo(String.format(Locale.US, "drag %.1f %.1f", p.latitude, p.longitude), marker);
			} 
 
			@Override 
			public void onMarkerDragEnd(Marker marker) {
				updateInfo("drag end", marker);
4
CodeRank

Related GoogleMap setOnMarkerDragListener Questions & Answers:

setOnMarkerDragListener Method Overview
Sets a callback that's invoked when a marker is dragged.
See Code Examples for other Android GoogleMap Methods: