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 sendSMS(Context context, String tel, String message) {
    Uri uri = Uri.parse("smsto:" + tel);
    Intent sendIntent = new Intent(Intent.ACTION_VIEW, uri);
    sendIntent.putExtra("sms_body", message);
    context.startActivity(sendIntent);//from  ww w. java  2  s .  c  o  m
}

From source file:Main.java

public static Intent getPhoneIntent() {
    Intent phoneIntent = new Intent(Intent.ACTION_DIAL);
    phoneIntent.setData(Uri.parse("tel:+1234567890"));
    return phoneIntent;
}

From source file:Main.java

public static void unInstallApp(Context context, String packageName) {
    Uri packageUri = Uri.parse("package:" + packageName);
    Intent intent = new Intent(Intent.ACTION_DELETE, packageUri);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);//from  w  ww.j  av  a  2 s .c om
}

From source file:Main.java

public static void uninstallApk(Context ctx, String packageName) {
    Uri packageURI = Uri.parse("package:" + packageName);
    Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
    uninstallIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    ctx.startActivity(uninstallIntent);/*from w  w  w .  j a v  a  2 s  .  co m*/
}

From source file:Main.java

public static void uninstallApk(Context context, String packageName) {
    Uri packageURI = Uri.parse("package:" + packageName);
    Intent intent = new Intent(Intent.ACTION_DELETE, packageURI);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);/*w w w  .  j av a 2s.  co m*/
}

From source file:Main.java

public static Uri createProfileUrl(@NonNull final String gplusId) {
    return Uri.parse("https://plus.google.com/" + gplusId);
}

From source file:Main.java

public static Intent getPluginsIntent() {
    return new Intent(Intent.ACTION_VIEW, Uri.parse("http://plugins.announcify.com/"));
    // market://search?q=Announcify
}

From source file:Main.java

public static void openSMS(Context getContext, String smsBody, String tel) {
    Uri uri = Uri.parse("smsto:" + tel);
    Intent it = new Intent(Intent.ACTION_SENDTO, uri);
    it.putExtra("sms_body", smsBody);
    getContext.startActivity(it);/*from   w  w w.  j  a  va 2s.c om*/
}

From source file:Main.java

public static void deletePackage(Context context, String packageName) {
    Uri packageURI = Uri.parse("package:" + packageName);
    Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
    context.startActivity(uninstallIntent);
}

From source file:Main.java

public static void uninstall(Context context, String packageName) {
    Uri packageURI = Uri.parse("package:" + packageName);
    Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
    uninstallIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(uninstallIntent);
}