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 launchAppMarket(Context context, String pkgname) {
    Uri uri = Uri.parse("market://details?id=" + pkgname);
    // uri = Uri.parse("market://details?id=" + "com.tencent.mobileqq");
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);//from w  w  w  .ja  v a2 s.  c  o m
}

From source file:Main.java

public static void callPhone(Activity activity, String phoneNumber) {
    Intent phoneIntent = new Intent("android.intent.action.CALL", Uri.parse("tel:" + phoneNumber));
    activity.startActivity(phoneIntent);
}

From source file:Main.java

public static void toScores(Context context) {
    try {// w w  w.ja  v a 2  s  .c o  m
        Uri uri = Uri.parse("market://details?id=" + context.getPackageName());
        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    } catch (Exception e) {
    }
}

From source file:Main.java

public static void sendSms(Context context, String phoneNumber, String content) {
    Uri uri = Uri.parse("smsto:" + (TextUtils.isEmpty(phoneNumber) ? "" : phoneNumber));
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    intent.putExtra("sms_body", TextUtils.isEmpty(content) ? "" : content);
    context.startActivity(intent);/*w  w  w  .  j  a  v a  2  s.co  m*/
}

From source file:Main.java

public static void dialog(Context context, String inputStr) {
    Intent phoneIntent = new Intent("android.intent.action.CALL", Uri.parse("tel:" + inputStr));

    context.startActivity(phoneIntent);//from   ww  w  . ja v a 2  s  .  c o m

}

From source file:Main.java

public static void playMedia(Context ctx, String link, String mime) {
    Uri path = Uri.parse(link);
    Intent intent = new Intent(Intent.ACTION_VIEW, path);
    intent.setDataAndType(path, "video/" + mime);
    ctx.startActivity(intent);/*from w w w  . j a va2s  . c om*/
}

From source file:Main.java

public static void call(String number, Context context) {
    Intent intent = new Intent(Intent.ACTION_DIAL);
    intent.setData(Uri.parse("tel:" + number));
    context.startActivity(intent);/* w w w .  jav a 2s. co m*/
}

From source file:Main.java

public static void openWeb(Context context, String url) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(url));
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);/*from ww  w.ja  v  a2  s. c o m*/
}

From source file:Main.java

public static void browse(String url) {
    Intent browseIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    _context.startActivity(browseIntent);
}

From source file:Main.java

public static void dial(Context context, String phoneNum) {
    Intent dial = new Intent(Intent.ACTION_DIAL);
    dial.setData(Uri.parse("tel:" + phoneNum));
    context.startActivity(dial);//  w  ww . j av  a2 s  . c  o m
}