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 openWithBrowser(Activity activity, String url) {
    Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    activity.startActivity(i);// ww  w.j  a v a  2 s  .co m
}

From source file:Main.java

public static String jointUrl(String url, Map<String, String> params) {
    if (params != null && params.size() > 0) {
        Uri uri = Uri.parse(url);
        Uri.Builder b = uri.buildUpon();
        for (Map.Entry<String, String> entry : params.entrySet()) {
            b.appendQueryParameter(entry.getKey(), entry.getValue());
        }/*from  w  ww.j a va  2 s .c  om*/
        return b.build().toString();
    }
    return url;
}

From source file:Main.java

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

From source file:Main.java

public static void allScan(Context context) {
    context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
            Uri.parse("file://" + Environment.getExternalStorageDirectory())));
}

From source file:Main.java

public static void makePhoneCall(Context context, String phoneNumber) {
    if (null != phoneNumber && phoneNumber.length() > 0) {
        Uri phoneUri = Uri.parse("tel:" + phoneNumber); // Could also use Uri.Builder
        Intent intent = new Intent(Intent.ACTION_CALL, phoneUri);
        context.startActivity(intent);//from  ww w  . jav a  2 s. c  o  m
    }
}

From source file:Main.java

public static void makeCall(Context context, String phoneNumber) {
    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel://" + phoneNumber));
    context.startActivity(intent);//from ww w .  ja va 2 s .  c o m
}

From source file:Main.java

public static void OpenURL(Context context, String url) {
    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    context.startActivity(browserIntent);
}

From source file:Main.java

public static void openUrl(Context context, String url) {
    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    context.startActivity(browserIntent);
}

From source file:Main.java

@Nullable
public static Uri createSDCardUri(String url) {
    if (TextUtils.isEmpty(url)) {
        return null;
    }/*from w w  w.  j ava 2s .c  o  m*/
    return Uri.parse("file:///" + url);
}

From source file:Main.java

public static void dialIn(Context context, String number) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_DIAL);
    intent.setData(Uri.parse("tel://" + number));
    context.startActivity(intent);//from   w w  w.j  a va 2s  . c om
}