List of usage examples for android.net Uri parse
public static Uri parse(String uriString)
From source file:Main.java
public static Intent getUninstallAppIntent(String packageName) { Intent intent = new Intent(Intent.ACTION_DELETE); intent.setData(Uri.parse("package:" + packageName)); return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); }
From source file:Main.java
public static void openURL(Activity activity, String url) { Intent webIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); activity.startActivity(webIntent);/*w w w . java 2 s . c o m*/ }
From source file:Main.java
public static void CallPhone(Context context, String phone) { Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phone)); context.startActivity(intent);/* w w w . j a v a2 s . co m*/ }
From source file:Main.java
public static void openBroswer(Context context, String url) { Intent it = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); // it.setClassName("com.android.browser", "com.android.browser.BrowserActivity"); context.startActivity(it);/*from ww w . jav a 2 s. c o m*/ }
From source file:Main.java
public static boolean isUrlOfHost(String url, String host) { if (url != null && host != null) { String urlHost = Uri.parse(url).getHost(); if (urlHost != null) { return urlHost.matches("^(.+\\.)?" + host + "$"); }/*from w ww . j ava 2s . c o m*/ } return false; }
From source file:Main.java
public static Uri getUriFromFile(String path) { if (TextUtils.isEmpty(path)) { return Uri.parse(""); } else {//w ww . j av a 2 s .c om return Uri.parse("file://" + path); } }
From source file:Main.java
private static String getUrl(String search) { Uri builtUri = Uri.parse(url).buildUpon().appendQueryParameter("q", search) .appendQueryParameter("maxResults", "20").build(); Log.d("DEBUG", builtUri.toString() + ". Search = " + search); return builtUri.toString(); }
From source file:Main.java
public static Uri getUriFromAsset(String path) { if (TextUtils.isEmpty(path)) { return Uri.parse(""); } else {//from w ww . jav a2 s. co m return Uri.parse("asset:///" + path); } }
From source file:Main.java
public static Intent newSendToIntent(String emailAddress, String subject, String contentBody) { return new Intent(Intent.ACTION_SENDTO).setData(Uri.parse("mailto:" + Uri.encode(emailAddress) + "?subject=" + Uri.encode(subject) + "&body=" + Uri.encode(contentBody))); }
From source file:Main.java
public static void callPhone(Context context, String phoneNum) { Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNum)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);/*from ww w . j av a2 s.c o m*/ }