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 getDomain(String uri) {
    try {//from  w w w  .ja  v a 2s  .  co m
        uri = Uri.parse(uri).buildUpon().build().getHost();
    } catch (Exception e) {
    }
    return uri;
}

From source file:Main.java

public static Uri getResUri(int resId) {
    return Uri.parse("res://xxyy/" + resId);
}

From source file:Main.java

public static String filenamefromPath(String path) {
    Uri u = Uri.parse(path);
    File f = new File("" + u);
    return f.getName();
}

From source file:Main.java

public static List<String> getPathSegments(String url) {
    return Uri.parse(url).getPathSegments();
}

From source file:Main.java

public static Uri getMargetUri(Context context) {
    return Uri.parse("market://details?id=" + context.getPackageName());
}

From source file:Main.java

private static Uri getReviewUri(Context context) {
    return Uri.parse("market://details?id=" + context.getPackageName());
}

From source file:Main.java

public static Intent getPlayStoreListingIntent() {
    Uri uri = Uri.parse("http://play.google.com/store/apps/details?id=" + "uk.co.sevendigital.android");
    Intent goToPlayStore = new Intent(Intent.ACTION_VIEW, uri);
    return goToPlayStore;
}

From source file:Main.java

public static Intent call(String paramString) {
    Uri localUri = Uri.parse("tel:" + paramString);
    return new Intent(Intent.ACTION_CALL, localUri);
}

From source file:Main.java

public static Intent uninstall(String packageName) {
    Uri uri = Uri.parse("package:" + packageName);
    Intent intent = new Intent(Intent.ACTION_DELETE, uri);
    return intent;
}

From source file:Main.java

/**
 * get the protocol of the url
 */
public static int getPort(String url) {
    return Uri.parse(url).getPort();
}