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 callPhone(Context context, String number) {
    Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(URL_TEL + number));
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);//from  w w w  . j av  a  2  s. co m
}

From source file:Main.java

public static void uninstall(Context context, String pkg) {
    context.startActivity(new Intent(Intent.ACTION_DELETE, Uri.parse("package:" + pkg)));
}

From source file:Main.java

@NonNull
public static Intent openDialer(@NonNull String number) {
    return new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + number));
}

From source file:Main.java

public static void goGoogleMarket(Context context) {
    Intent i = new Intent(Intent.ACTION_VIEW);
    i.setData(Uri.parse("market://search?q=" + context.getPackageName()));
    context.startActivity(i);/* w  w w  .j  ava 2 s  .  co  m*/
}

From source file:Main.java

public static void startSearchPlayApplication(Context mContext, String pkgName) {
    try {//from  w  w  w  . jav a 2  s. c om
        Intent mIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + pkgName));
        mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        mContext.startActivity(mIntent);
    } catch (android.content.ActivityNotFoundException anfe) {
        Intent mIntent1 = new Intent(Intent.ACTION_VIEW,
                Uri.parse("https://play.google.com/store/apps/details?id=" + pkgName));
        mIntent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        mContext.startActivity(mIntent1);
    }
}

From source file:Main.java

/**  -----------------------------------------------------------------------  External URL -- */

public static Intent newExternalUrlIntent(String url) {
    return new Intent(Intent.ACTION_VIEW, Uri.parse(url));
}

From source file:Main.java

public static void openInBrowser(Activity activity, String link) {
    Intent sharingIntent = new Intent(android.content.Intent.ACTION_VIEW);
    sharingIntent.setData(Uri.parse(link));
    activity.startActivity(sharingIntent);
}

From source file:Main.java

public static void openBrowser(Context context, String url) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(url));
    context.startActivity(intent);//from  ww  w  .j a va 2 s. c o  m
}

From source file:Main.java

public static void callNum(Context context, String number) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_CALL);
    intent.setData(Uri.parse("tel:" + number));
    context.startActivity(intent);/*  w w  w .  j  a  v  a  2s . c o m*/
}

From source file:Main.java

public static void gotoMarket(Context context, String pck) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.setData(Uri.parse("market://details?id=" + pck));
    context.startActivity(intent);// w ww  .  j  a  v  a2  s  .c o m
}