List of usage examples for android.content Intent Intent
public Intent()
From source file:Main.java
public static void installAPK(Context context, String apkFile) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(apkFile)), "application/vnd.android.package-archive"); context.startActivity(intent);// w w w .j av a 2 s. c o m }
From source file:Main.java
public static void openImageAction(Activity activity, int requestCode) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); activity.startActivityForResult(intent, requestCode); }
From source file:Main.java
public static void installAPK(Context context, File apkFile) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive"); context.startActivity(intent);// w ww . j a v a2s .co m }
From source file:Main.java
public static void openAlbum(Activity activity) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); activity.startActivityForResult(intent, PICK_IMAGE_ACTIVITY_REQUEST_CODE); }
From source file:Main.java
public static void InstallApk(Context context, String path) { Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(android.content.Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(path)), "application/vnd.android.package-archive"); context.startActivity(intent);/*from ww w . ja va2s. c o m*/ }
From source file:Main.java
public static void startActivity(Activity activity, Class classActivity) { Intent intent = new Intent(); intent.setClass(activity, classActivity); activity.startActivity(intent);/*from w w w.j a v a 2 s . c o m*/ }
From source file:Main.java
public static void jumpToActivity(Context context, Class<?> cls, Bundle bundle) { Intent jumpIntent = new Intent(); if (bundle != null) jumpIntent.putExtras(bundle);/* w w w . java2s.com*/ jumpIntent.setClass(context, cls); context.startActivity(jumpIntent); }
From source file:Main.java
public static Intent showOpenTypeDialog(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, "*/*"); return intent; }
From source file:Main.java
public static void startBrowser(Context context, String url) { try {//from w ww. j ava2 s . co m Intent intent = new Intent(); intent.setAction("android.intent.action.VIEW"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Uri content_url = Uri.parse(url); intent.setData(content_url); context.startActivity(intent); } catch (Exception e) { } }
From source file:Main.java
public static void installApk(Context context, File file) { Intent intent = new Intent(); intent.setAction("android.intent.action.VIEW"); intent.addCategory("android.intent.category.DEFAULT"); intent.setType("application/vnd.android.package-archive"); intent.setData(Uri.fromFile(file));/*from w w w . j av a 2s . c o m*/ intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }