List of usage examples for android.net Uri parse
public static Uri parse(String uriString)
From source file:Main.java
public static void playTrailer(Context context, String key) { Intent intent;/*from w ww . ja v a 2 s . c o m*/ try { intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:" + key)); context.startActivity(intent); } catch (ActivityNotFoundException ex) { intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=" + key)); context.startActivity(intent); } }
From source file:Main.java
public static void uninstallApk(Context context, String packageName) { Intent intent = new Intent("android.intent.action.DELETE"); Uri packageURI = Uri.parse("package:" + packageName); intent.setData(packageURI);/* w ww.jav a 2 s . co m*/ context.startActivity(intent); }
From source file:Main.java
public static void showAppInfo(String packageName, Context context) { Intent intent = new Intent(); intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS"); intent.setData(Uri.parse("package:" + packageName)); context.startActivity(intent);//from w w w .j av a2s. c o m }
From source file:Main.java
public static void openAppInfo(Context context, String packageName) { Intent intent = new Intent(); intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS"); intent.setData(Uri.parse("package:" + packageName)); context.startActivity(intent);//from ww w.j a v a2 s. co m }
From source file:Main.java
public static void sendMessage(Context activity, String phoneNumber, String smsContent) { if (phoneNumber == null || phoneNumber.length() < 4) { return;/*from w w w . j a v a 2 s . c o m*/ } Uri uri = Uri.parse("smsto:" + phoneNumber); Intent it = new Intent(Intent.ACTION_SENDTO, uri); it.putExtra("sms_body", smsContent); it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); activity.startActivity(it); }
From source file:Main.java
private static boolean startBrowserActivity(@NonNull Context context, @NonNull String url) { try {//from w ww . ja v a 2 s. c o m Intent it = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); context.startActivity(it); } catch (Exception e) { e.printStackTrace(); return false; } return true; }
From source file:Main.java
public static void dialNumber(Activity context, String phoneNumber) { if (context == null) { return;/*w w w .j a va2 s . c om*/ } Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:" + phoneNumber)); context.startActivity(intent); }
From source file:Main.java
public static void showWebPage(String url, Context context) { if (TextUtils.isEmpty(url)) return;/* ww w . java 2 s . c om*/ Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); context.startActivity(intent); }
From source file:Main.java
public static void uninstallApk(Context context, String packageName) { Intent intent = new Intent(Intent.ACTION_DELETE); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Uri packageURI = Uri.parse("package:" + packageName); intent.setData(packageURI);/*w w w . j ava 2 s. c om*/ context.startActivity(intent); }
From source file:Main.java
public static void openView(Context context, String url) { try {//from w ww . j a v a 2 s . c om Intent intentUri = new Intent(Intent.ACTION_VIEW); intentUri.setData(Uri.parse(url)); intentUri.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intentUri); } catch (Exception e) { } }