Android Marker - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Marker class.

This code example shows how to use the following methods:getId
/*** 
  Copyright (c) 2012 CommonsWare, LLC 
  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. 
   
  From _The Busy Coder's Guide to Android Development_ 
    http://commonsware.com/Android 
 */ 
 
package com.commonsware.android.mapsv2.imagepopups; 
 
import android.net.Uri; 
import android.os.Build; 
import android.os.Bundle; 
import android.widget.ArrayAdapter; 

7
CodeRank
This code example shows how to use the following methods:getPosition, setSnippet, showInfoWindow
        super.onDestroy(); 
    } 
 
    public boolean onMarkerClick(Marker marker) {
        updateMarkerDistance(marker);
        marker.showInfoWindow();
 
        return true; 
    } 
 
    public void updateMarkerDistance(Marker marker) {
        if (map.getMyLocation() == null) {
 
            marker.setSnippet("");
 
        } else { 
 
            float[] results = new float[1];
 
            Location.distanceBetween(map.getMyLocation().getLatitude(), map.getMyLocation().getLongitude(),

7
CodeRank
This code example shows how to use the following methods:getSnippet, getTitle
        return location == null ? new LatLng(LONDON_LAT, LONDON_LONG) : new LatLng(location.getLatitude(), location.getLongitude());
    } 
 
    @Override 
    public void onInfoWindowClick(Marker marker) {
        new AlertDialog.Builder(getActivity()).setTitle(marker.getTitle()).setMessage(marker.getSnippet()).show();
    } 
 
} 
6
CodeRank
This code example shows how to use the following methods:
/*** 
  Copyright (c) 2012 CommonsWare, LLC 
  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. 
   
  From _The Busy Coder's Guide to Android Development_ 
    http://commonsware.com/Android 
 */ 
 
6
CodeRank
This code example shows how to use the following methods:getSnippet, getTitle, isDraggable, isInfoWindowShown, remove
This code example shows how to use the following methods:
/*** 
  Copyright (c) 2012 CommonsWare, LLC 
  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. 
   
  From _The Busy Coder's Guide to Android Development_ 
    http://commonsware.com/Android 
 */ 
 
6
CodeRank
This code example shows how to use the following methods:getPosition
        Toast.makeText(this, "Drag the markers!", Toast.LENGTH_LONG).show();
        showDistance(); 
    } 
 
    private void showDistance() { 
        double distance = SphericalUtil.computeDistanceBetween(mMarkerA.getPosition(), mMarkerB.getPosition());
        mTextView.setText("The markers are " + formatNumber(distance) + " apart.");
    } 
 
    private void updatePolyline() { 
        mPolyline.setPoints(Arrays.asList(mMarkerA.getPosition(), mMarkerB.getPosition()));
    } 
 
    private String formatNumber(double distance) {
        String unit = "m";
        if (distance < 1) {
            distance *= 1000;
            unit = "mm";
        } else if (distance > 1000) {
            distance /= 1000;
6
CodeRank
This code example shows how to use the following methods:
/*** 
  Copyright (c) 2012 CommonsWare, LLC 
  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. 
   
  From _The Busy Coder's Guide to Android Development_ 
    http://commonsware.com/Android 
 */ 
 
6
CodeRank
This code example shows how to use the following methods:
/*** 
  Copyright (c) 2012 CommonsWare, LLC 
  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. 
   
  From _The Busy Coder's Guide to Android Development_ 
    http://commonsware.com/Android 
 */ 
 
6
CodeRank
This code example shows how to use the following methods:setPosition, setSnippet, setTitle
 
    private void moveMarkerTo(LatLng position, Address address) {
        if (mMarker == null) {
            mMarker = mMap.addMarker(new MarkerOptions().position(position));
        } else { 
            mMarker.setPosition(position);
        } 
        mMarker.setTitle(Utils.prettyPrint(address));
        mMarker.setSnippet(Utils.prettyPrint(position));
    } 
 
    @Override 
    public Location getLocation() {
        return mMap.getMyLocation();
    } 
 
    @Override 
    public void onMyLocationClickIgnored(AddressView sender) {
        LatLng latLng = Utils.locationToLatLng(mMap.getMyLocation());
        CameraUpdate update = CameraUpdateFactory.newLatLng(latLng);
6
CodeRank

Related Android Marker Questions & Answers:

Other Android Marker Examples

23:	    map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
24:	        .getMap();
25:	    Marker hamburg = map.addMarker(new MarkerOptions().position(HAMBURG)
26:	        .title("Hamburg"));
27:	    Marker kiel = map.addMarker(new MarkerOptions()
-
25:	    Marker hamburg = map.addMarker(new MarkerOptions().position(HAMBURG)
26:	        .title("Hamburg"));
27:	    Marker kiel = map.addMarker(new MarkerOptions()
28:	        .position(KIEL)
29:	        .title("Kiel")

Read More

See Code Examples for Android Marker Methods: