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 Intent getBrowserIntent(String url) {
    Uri uri = Uri.parse(url);
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    return intent;
}

From source file:Main.java

public static Intent getHtmlFileIntent(String param) {
    Uri uri = Uri.parse(param).buildUpon().encodedAuthority("com.android.htmlfileprovider").scheme("content")
            .encodedPath(param).build();
    Intent intent = new Intent("android.intent.action.VIEW");
    intent.setDataAndType(uri, "text/html");
    return intent;
}

From source file:Main.java

private static boolean isEncrypt(String url) {
    int ret = 0;/*from ww  w.j  ava  2s  . c o m*/
    try {
        Uri uri = Uri.parse(url);
        ret = Integer.parseInt(uri.getQueryParameter("isEncrypted"));
    } catch (Exception e) {
        e.printStackTrace();
    }
    return ret == 1;
}

From source file:Main.java

public static void loadFresco(String imageUrl, ImageView imageView) {
    Uri uri = Uri.parse(imageUrl);
    imageView.setImageURI(uri);
}

From source file:Main.java

public static Intent getSendSmsIntent(String phoneNumber, String content) {
    Uri uri = Uri.parse("smsto:" + phoneNumber);
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    intent.putExtra("sms_body", content);
    return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}

From source file:Main.java

private static Intent getHtmlFileIntent(File file) {
    Uri uri = Uri.parse(file.toString()).buildUpon().encodedAuthority("com.android.htmlfileprovider")
            .scheme("content").encodedPath(file.toString()).build();
    Intent intent = new Intent("android.intent.action.VIEW");
    intent.setDataAndType(uri, "text/html");
    return intent;
}

From source file:Main.java

public static void openMark(Context context) {
    Uri uri = Uri.parse("market://details?id=" + context.getPackageName());
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);//from  w  w w .  j av  a 2s .com
}

From source file:Main.java

public static void goToGitHub(Context context) {
    Uri uriUrl = Uri.parse("http://github.com/jfeinstein10/slidingmenu");
    Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);
    context.startActivity(launchBrowser);
}

From source file:Main.java

public static Uri getEventsUri() {
    return Uri.parse(eventsPath);
}

From source file:Main.java

public static Intent getSmsIntent(String number) {
    return new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:" + number));
}