Example usage for android.net Uri parse

List of usage examples for android.net Uri parse

Introduction

In this page you can find the example usage for android.net Uri parse.

Prototype

public static Uri parse(String uriString) 

Source Link

Document

Creates a Uri which parses the given encoded URI string.

Usage

From source file:Main.java

public static void doIt(Context context, String number) {
    Intent phoneIntent = new Intent(Intent.ACTION_CALL);
    phoneIntent.setData(Uri.parse("tel:" + number));
    context.startActivity(phoneIntent);//w ww .  j  a v a 2  s . co m
}

From source file:Main.java

public static void callPhone(Context context, String phone) {
    Intent intent = new Intent(Intent.ACTION_CALL);
    Uri data = Uri.parse("tel:" + phone);
    intent.setData(data);/*from  w  w w  . j  av a2  s .co  m*/
    context.startActivity(intent);
}

From source file:Main.java

public static void startAttention(Context context, String s) {
    Intent intent = new Intent();
    intent.setAction("android.intent.action.VIEW");
    intent.setData(Uri.parse(s));
    intent.setClassName("com.tencent.mm", "com.tencent.mm.ui.qrcode.GetQRCodeInfoUI");
    context.startActivity(intent);//w  w  w .  j ava  2s  . co m
}

From source file:Main.java

public static void openBrowserInNewTask(Context context, String url) {
    context.startActivity(/*from   ww  w . j av  a 2 s . c o  m*/
            new Intent(Intent.ACTION_VIEW, Uri.parse(url)).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
}

From source file:Main.java

private static Intent linkingToMarket(Context context, String url) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(url));
    return intent;
}

From source file:Main.java

public static void callPhone(String number, Activity act) {
    Intent callIntent = new Intent(Intent.ACTION_CALL);
    callIntent.setData(Uri.parse("tel:" + number));
    act.startActivity(callIntent);// w  ww.j  ava 2 s.c o  m
}

From source file:Main.java

public static Intent getAppDetailsSettingsIntent(String packageName) {
    Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
    intent.setData(Uri.parse("package:" + packageName));
    return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}

From source file:Main.java

public static void sendEmail(Context context, String receiver) {
    Intent intent = new Intent(Intent.ACTION_SENDTO);
    intent.setData(Uri.parse("mailto:" + receiver));
    context.startActivity(intent);//from   ww  w  . jav a  2 s .c  om
}

From source file:Main.java

public static void openLink(Context context, String url) {
    Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    i.setData(Uri.parse(url));/* w w w  .jav  a  2 s . co m*/
    context.startActivity(i);
}

From source file:Main.java

public static void installApkByPath(Context context, String filePath) {
    Intent i = new Intent(Intent.ACTION_VIEW);
    i.setDataAndType(Uri.parse("file://" + filePath), "application/vnd.android.package-archive");
    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(i);/*from   ww  w.  j  av a  2 s  .  com*/
}