Android Intent Create locate(Context context, String chooserTilte, String lat, String lng, String addr)

Here you can find the source of locate(Context context, String chooserTilte, String lat, String lng, String addr)

Description

locate

License

Open Source License

Declaration

public static void locate(Context context, String chooserTilte,
            String lat, String lng, String addr) 

Method Source Code

//License from project: Open Source License 

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Looper;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.WindowManager;
import android.webkit.URLUtil;

public class Main{
    public static void locate(Context context, String chooserTilte,
            String lat, String lng, String addr) {
        if (null == context) {
            return;
        }/*from ww w  . j  av  a  2  s  . c  o  m*/
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_VIEW);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        //      intent.setData(Uri.parse("geo:" + lat + "," + lng + "?q=my+street+address"));
        String uri = "geo:0,0" + "?q=" + lat + "," + lng;
        if (null != addr && addr.length() > 0) {
            uri += ("(" + addr + ")");
        }
        intent.setData(Uri.parse(uri));

        try {
            context.startActivity(Intent
                    .createChooser(intent, chooserTilte).addFlags(
                            Intent.FLAG_ACTIVITY_NEW_TASK));
            //         context.startActivity(intent);
        } catch (Exception e) {
            ToastUtil.showToast(context, "exception");
        }
    }
}

Related

  1. constructGoogleCalendarIntentVariant1()
  2. constructGoogleCalendarIntentVariant2()
  3. createNotification(Intent resultIntent, Context current, final Class destination)
  4. getExtraObject(Activity context, String key)
  5. gotoHome(Context context)
  6. putParamters(Intent intent, Object[] parameters)
  7. to(Context context, Class cls)
  8. to(Context context, Class cls, Bundle data)
  9. putParamters(Intent intent, Object[] parameters)