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 Uri getUriFromRes(int resid) {
    if (resid == -1) {
        return Uri.parse("");
    } else {/*from  www  .ja  v a  2s. c o m*/
        return Uri.parse("res:///" + resid);
    }
}

From source file:Main.java

public static void openSendMsg(Context context) {
    Uri uri = Uri.parse("smsto:");
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);/*from  w  ww .j av a 2s .  c  o m*/
}

From source file:Main.java

public static void openUrl(Context context, String url) {
    Uri uri = Uri.parse(url);
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    context.startActivity(intent);/*from w w w  .  jav a 2  s  .  c o m*/
}

From source file:Main.java

public static void openSendMsg(Context getContext) {
    Uri uri = Uri.parse("smsto:");
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    getContext.startActivity(intent);//from   w ww  .  j a  v  a  2s .  com
}

From source file:Main.java

/**
 * get the scheme of the url
 * @param url
 * @return
 */
public static String getScheme(String url) {
    return Uri.parse(url).getScheme();
}

From source file:Main.java

public static void uninstall(Context context) {
    Uri packageURI = Uri.parse("package:" + context.getPackageName());
    Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
    context.startActivity(uninstallIntent);
}

From source file:Main.java

public static Intent getDialIntent(String phoneNumber) {
    Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNumber));
    return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}

From source file:Main.java

public static void openMap(Context context, String uri) {
    Uri mUri = Uri.parse(uri);
    Intent mIntent = new Intent(Intent.ACTION_VIEW, mUri);
    context.startActivity(mIntent);/*  w  w w  .ja v  a 2s.  c o  m*/
}

From source file:Main.java

public static Intent newCallNumberIntent(String number) {
    return new Intent(new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + number)));
}

From source file:Main.java

public static Map<String, String> getQueryMap(String url) {
    String query = Uri.parse(url).getQuery();
    String[] params = query.split("&");
    Map<String, String> map = new HashMap<>();
    for (String param : params) {
        String name = param.split("=")[0];
        String value = param.split("=")[1];
        map.put(name, value);//w ww . jav a2  s.  c  o  m
    }
    return map;
}