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 Intent getPlayServicesIntent() {
    return new Intent(Intent.ACTION_VIEW).setData(Uri.parse("market://details?id=com.google.android.gms"));
}

From source file:Main.java

public static void makeCall(String phoneNumber, Context context) {
    String number = String.format("tel:%s", phoneNumber);
    Intent callIntent = new Intent(Intent.ACTION_DIAL, Uri.parse(number));
    context.startActivity(callIntent);//from w  w w. j  ava2 s .  c  o  m
}

From source file:Main.java

public static void call(Context cxt, String number) {
    String phoneUri = "tel:";
    phoneUri = phoneUri.concat(number);/*  www.  j a v a2 s.c o  m*/
    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse(phoneUri));
    cxt.startActivity(intent);
}

From source file:Main.java

public static void jumpToSystemDownloadApk(Context context, String url) {
    Intent intent = new Intent("android.intent.action.VIEW");
    Uri data = Uri.parse(Html.fromHtml(url).toString());
    intent.setData(data);//from   ww w  .j  a  v  a  2s .c om
    intent.setPackage("com.google.android.browser");
    intent.addCategory("android.intent.category.BROWSABLE");
    intent.setComponent(new ComponentName("com.android.browser", "com.android.browser.BrowserActivity"));
    context.startActivity(intent);
}

From source file:Main.java

public static void openAppDetails(Context context, String pkgname) {
    Intent i = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    i.addCategory(Intent.CATEGORY_DEFAULT);
    Uri data = Uri.parse("package:" + pkgname);
    i.setData(data);/*w  w w .j  ava2s  .  c  om*/
    context.startActivity(i);
}

From source file:Main.java

/**
 * use for sending mail to any id//from   w ww . ja  v a2  s. c  om
 *
 * @param mContext context
 * @param mailID   email id of whom to send mail
 */
public static void sendMail(Context mContext, String mailID) {
    Uri uri = Uri.parse("mailto:" + mailID);
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    mContext.startActivity(intent);
}

From source file:Main.java

public static void callSms(Context context, String number, String content) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_SENDTO);
    intent.putExtra("sms_body", content);
    intent.setData(Uri.parse(String.format("smsto:%s", number)));
    context.startActivity(intent);//from  w w  w.  j  av a  2 s .  c o  m
}

From source file:Main.java

public static boolean callPhone(Context context, String phone) {
    try {/*  ww  w.j  a  v  a 2 s  .  c o m*/
        Intent callIntent = new Intent(Intent.ACTION_CALL);
        callIntent.setData(Uri.parse("tel:" + phone));
        context.startActivity(callIntent);
        return true;
    } catch (ActivityNotFoundException e) {
        return false;
    }
}

From source file:Main.java

public static void callPhone(Context context, String number) {
    Intent intent2 = new Intent(Intent.ACTION_DIAL);
    if (TextUtils.isEmpty(number))
        return;/*from   w w w  . j  a  v a  2s  . c  o m*/
    Uri data2 = Uri.parse("tel:" + number);
    intent2.setData(data2);
    context.startActivity(intent2);
}

From source file:Main.java

public static void allScan(Context context) {
    if (null == context) {
        return;//from w w  w  .j  a v a 2 s. com
    }

    context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
            Uri.parse("file://" + android.os.Environment.getExternalStorageDirectory())));
}