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 call(Context context, String phoneNumber) {
    context.startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber)));
}

From source file:Main.java

public static void onCallPhone(Context context, String mobile) {
    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + mobile));
    context.startActivity(intent);/*from   w w  w  .jav a 2s. c o m*/
}

From source file:Main.java

@Nullable
public static Uri createResUri(int resInt) {
    if (resInt <= 0) {
        return null;
    }//from  w ww . j a  v a  2 s.c  o m
    return Uri.parse("res:///" + resInt);
}

From source file:Main.java

public static void sendSMS(String smsBody, Context context, String num)

{

    Uri smsToUri = Uri.parse("smsto:" + num);

    Intent intent = new Intent(Intent.ACTION_SENDTO, smsToUri);

    intent.putExtra("sms_body", smsBody);

    context.startActivity(intent);/*from www. j  av  a2s  . co m*/

}

From source file:Main.java

public static void openBrowser(Activity activity, String url) {
    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    activity.startActivity(browserIntent);
}

From source file:Main.java

public static void scoreApp(Activity activity) {
    Uri uri = Uri.parse("market://details?id=" + activity.getPackageName());
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    try {//from ww w. j  a  va  2  s  .c  o m
        activity.startActivity(intent);
    } catch (ActivityNotFoundException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static int m6967a(Context context, String str) {
    MediaPlayer create = MediaPlayer.create(context, Uri.parse(str));
    if (create == null) {
        return 0;
    }//from   w w w.  ja va  2s. c o m
    int duration = create.getDuration() / 1000;
    create.reset();
    create.release();
    return duration;
}

From source file:Main.java

public static void callDial(Context context, String phoneNumber) {
    context.startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNumber)));
}

From source file:Main.java

public static void composeTel(Context context, String phoneNumber) {
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("tel:" + phoneNumber));
    context.startActivity(intent);//  www  . j  av a2 s  .  c o m
}

From source file:Main.java

public static void dial(Context context, String phoneNumber) {
    context.startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNumber)));
}