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 int getPort(String url) {
    return Uri.parse(url).getPort();
}

From source file:Main.java

public static String getHost(String url) {
    return Uri.parse(url).getHost();
}

From source file:Main.java

public static Uri string2Uri(String string) {
    return Uri.parse(string);
}

From source file:Main.java

static public Uri alarmIdToUri(long alarmId) {
    return Uri.parse("alarm_id:" + alarmId);
}

From source file:Main.java

public static String getPathScheme(String path) {
    return Uri.parse(path).getScheme();
}

From source file:Main.java

public static Uri getassetFrescoUri(int asset) {
    return Uri.parse("asset://" + asset);
}

From source file:Main.java

public static String createFaviconUrl(String url) {
    return Uri.parse(url).buildUpon().path("favicon.ico").toString();
}

From source file:Main.java

public static Uri getValidUri(String s) {
    Uri uri1 = Uri.parse(s);
    Uri uri = uri1;/*www.  j  a va 2 s . com*/
    if (uri1.getScheme() == null) {
        uri = Uri.parse((new StringBuilder("http://")).append(s).toString());
    }
    return uri;
}

From source file:Main.java

public static String parseUriToName(String url) {
    Uri uri = Uri.parse(url);
    String name = uri.getLastPathSegment();
    return name;
}

From source file:Main.java

public static Uri getAppResourceUri(int resId, String packageName) {
    return Uri.parse("android.resource://" + packageName + "/" + resId);
}