Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.content.Intent;

import android.net.Uri;

import java.util.Locale;

public class Main {
    /** -----------------------------------------------------------------------  Google Maps -- */

    public static Intent newOpenMapsAtLatLongAndName(String latitude, String longitude, String name) {
        Intent intent = new Intent(Intent.ACTION_VIEW,
                Uri.parse(String.format(Locale.ENGLISH, "geo:%s,%s", latitude, longitude) + "?q="
                        + Uri.encode(latitude + "," + longitude + "(" + name + ")") + "&z=16"));
        intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
        return intent;
    }
}