show Map App - Android App

Android examples for App:APK Information

Description

show Map App

Demo Code


//package com.java2s;

import android.content.Context;
import android.content.Intent;

import android.net.Uri;

public class Main {
    /**/*w  ww. ja  v  a  2s  .  co  m*/
     * @param a
     * @param geoLocation
     * 
     *            geo:latitude,longitude Show the map at the given longitude and
     *            latitude. Example: "geo:47.6,-122.3" <br>
     * <br>
     *            geo:latitude,longitude?z=zoom Show the map at the given
     *            longitude and latitude at a certain zoom level. A zoom level
     *            of 1 shows the whole Earth, centered at the given lat,lng. The
     *            highest (closest) zoom level is 23. Example:
     *            "geo:47.6,-122.3?z=11"<br>
     * <br>
     *            geo:0,0?q=lat,lng(label) Show the map at the given longitude
     *            and latitude with a string label. Example:
     *            "geo:0,0?q=34.99,-106.61(Treasure)"<br>
     * <br>
     *            geo:0,0?q=my+street+address Show the location for
     *            "my street address" (may be a specific address or location
     *            query). Example: "geo:0,0?q=1600+Amphitheatre+Parkway%2C+CA"<br>
     * <br>
     *            Note: All strings passed in the geo URI must be encoded. For
     *            example, the string 1st & Pike, Seattle should become
     *            1st%20%26%20Pike%2C%20Seattle. Spaces in the string can be
     *            encoded with %20 or replaced with the plus sign (+).
     */
    public static void showMapApp(Context a, Uri geoLocation) {
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setData(geoLocation);
        if (intent.resolveActivity(a.getPackageManager()) != null) {
            a.startActivity(intent);
        }
    }
}

Related Tutorials