List of usage examples for android.content Intent ACTION_VIEW
String ACTION_VIEW
To view the source code for android.content Intent ACTION_VIEW.
Click Source Link
From source file:Main.java
public static void sendMessage(Context context, String number, String message) { Uri uri = Uri.parse("smsto:" + number); Intent sendIntent = new Intent(Intent.ACTION_VIEW, uri); sendIntent.putExtra("sms_body", message); context.startActivity(sendIntent);//from w ww. ja v a2 s.c o m }
From source file:Main.java
public static Intent getPlayStoreListingIntent() { Uri uri = Uri.parse("http://play.google.com/store/apps/details?id=" + "uk.co.sevendigital.android"); Intent goToPlayStore = new Intent(Intent.ACTION_VIEW, uri); return goToPlayStore; }
From source file:Main.java
public static void sendSMS(Context context, String number, String message) { Uri uri = Uri.parse("smsto:" + number); Intent sendIntent = new Intent(Intent.ACTION_VIEW, uri); sendIntent.putExtra("sms_body", message); context.startActivity(sendIntent);/*from w w w . java 2 s. c o m*/ }
From source file:Main.java
public static void launchWeb(Context activityContext, String url) { //Log.d(TAG, "launchWeb::"+url); Intent in = new Intent(); in.setAction(Intent.ACTION_VIEW); in.addCategory(Intent.CATEGORY_BROWSABLE); in.setData(Uri.parse(url));// w ww.j a v a2 s .c o m activityContext.startActivity(in); }
From source file:Main.java
public static void openContactInfo(final Context context, final long contactid) { final Intent intent = new Intent(Intent.ACTION_VIEW); final Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, String.valueOf(contactid)); intent.setData(uri);//from ww w . j av a2s .co m context.startActivity(intent); }
From source file:Main.java
public static void openFile(File aFile, Context context) { Intent myIntent = new Intent(android.content.Intent.ACTION_VIEW); File file = new File(aFile.getAbsolutePath()); String extension = android.webkit.MimeTypeMap.getFileExtensionFromUrl(Uri.fromFile(file).toString()); String mimetype = android.webkit.MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); myIntent.setDataAndType(Uri.fromFile(file), mimetype); context.startActivity(myIntent);/* w w w .j a v a 2s . c o m*/ }
From source file:Main.java
public static void openWebSite(Context context, String url) { Uri uri = Uri.parse(url);/* w w w . j ava 2 s . com*/ Intent it = new Intent(Intent.ACTION_VIEW, uri); it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(it); }
From source file:Main.java
public static final void install(Context context, String path) { Intent intent = new Intent(); intent.setAction(android.content.Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setDataAndType(Uri.parse("file://" + path), "application/vnd.android.package-archive"); context.startActivity(intent);/*from w w w. j a v a 2s .c o m*/ }
From source file:Main.java
public static boolean openUrlSchema(Context context, String uri) { try {// w w w .j av a 2s . c om Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); context.startActivity(intent); } catch (Exception e) { e.printStackTrace(); return false; } return true; }
From source file:Main.java
public static Intent getApkFileIntent(String param) { Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(android.content.Intent.ACTION_VIEW); Uri uri = Uri.fromFile(new File(param)); intent.setDataAndType(uri, "application/vnd.android.package-archive"); return intent; }