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 String unInstallBySys(Context context, String pckName) {
    Intent intent = new Intent();
    Uri uri = Uri.parse("package:" + pckName);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(Intent.ACTION_DELETE);
    intent.setData(uri);// ww w. j  a  v  a 2  s .  c  o  m
    context.startActivity(intent);
    return null;
}

From source file:Main.java

public static void openPost(Context context, String postUrl) {
    try {/*w w w .  j a  v a 2  s  .com*/
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(postUrl));
        context.startActivity(intent);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void callSystemActionDial(Context context, String phone) {
    Uri uri = Uri.parse("tel:" + phone);
    Intent intent = new Intent(Intent.ACTION_DIAL, uri);
    context.startActivity(intent);/*w w  w  .  j  av a  2  s  .  c  o m*/
}

From source file:Main.java

public static void downloadGooglePlayServices(Activity activity) {
    Intent marketIntent = new Intent(Intent.ACTION_VIEW,
            Uri.parse("market://details?id=com.google.android.gms"));
    activity.startActivity(marketIntent);
}

From source file:Main.java

public static void dial(Context context, String number) {
    Intent intent = new Intent(Intent.ACTION_DIAL);
    intent.setData(Uri.parse("tel:" + number));
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);/*from   ww  w.  j av a 2s  . c o  m*/
}

From source file:Main.java

public static void openEmail(Context context, String email) {
    Intent data = new Intent(Intent.ACTION_SENDTO);
    data.setData(Uri.parse(email));
    context.startActivity(data);// w w  w.j  a  v a  2s  .c  o  m
}

From source file:Main.java

public static Ringtone get_ringtone(Context m, Object uri) {

    return RingtoneManager.getRingtone(m, Uri.parse(uri + ""));
}

From source file:Main.java

public static void startCall(Context context, String uri) {
    Intent intent = new Intent(Intent.ACTION_CALL);
    intent.setData(Uri.parse(uri));
    context.startActivity(intent);/*from  w w  w  .  j  a  v a 2s  . c  o  m*/
}

From source file:Main.java

public static Boolean sendSms(Context mContext, String smstext) {
    Uri smsToUri = Uri.parse("smsto:");
    Intent mIntent = new Intent(Intent.ACTION_SENDTO, smsToUri);
    mIntent.putExtra("sms_body", smstext);
    mContext.startActivity(mIntent);/*w  ww . j  av a 2  s .  c  o m*/
    return null;
}

From source file:Main.java

public static void openUrl(Context cotx, String url) {
    Activity act = (Activity) cotx;/*from ww  w  . j ava 2 s .com*/
    Uri uri = Uri.parse(url);
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    act.startActivity(intent);
}