List of usage examples for android.content Intent setAction
public @NonNull Intent setAction(@Nullable String action)
From source file:Main.java
public static boolean gotoGoogleMarket(Activity activity, String pck) { try {//from w w w. ja v a2s . c o m Intent intent = new Intent(); intent.setPackage("com.android.vending"); intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri.parse("market://details?id=" + pck)); activity.startActivity(intent); return true; } catch (Exception e) { e.printStackTrace(); return false; } }
From source file:Main.java
public static void install(Activity activity, File apkFile) { Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(android.content.Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive"); activity.startActivity(intent);/*from www . j a v a 2 s.co m*/ }
From source file:Main.java
public static void installApk(Context context, File file) { Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); context.startActivity(intent);//from www . ja v a 2 s.c o m }
From source file:Main.java
public static void installApk(Context context, String apkPath) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("file://" + apkPath), "application/vnd.android.package-archive"); context.startActivity(intent);// w ww .j a va 2s. com }
From source file:Main.java
public static void setClickable(final TextView textView) { textView.setMovementMethod(LinkMovementMethod.getInstance()); Spannable sp = (Spannable) textView.getText(); ImageSpan[] images = sp.getSpans(0, textView.getText().length(), ImageSpan.class); for (ImageSpan span : images) { final String image_src = span.getSource(); final int start = sp.getSpanStart(span); final int end = sp.getSpanEnd(span); ClickableSpan click_span = new ClickableSpan() { @Override/*from w w w.jav a2s. co m*/ public void onClick(View widget) { String[] strs = image_src.split("/"); String filePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/LilyClient/" + strs[strs.length - 2] + "-" + strs[strs.length - 1]; Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setType("image/*"); intent.setDataAndType(Uri.fromFile(new File(filePath)), "image/*"); textView.getContext().startActivity(intent); } }; ClickableSpan[] click_spans = sp.getSpans(start, end, ClickableSpan.class); if (click_spans.length != 0) { for (ClickableSpan c_span : click_spans) { sp.removeSpan(c_span); } } sp.setSpan(click_span, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } }
From source file:Main.java
/** * Install apk// w ww. j a v a2s.co m */ public static void installApk(Context context, Uri file) { Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(file, "application/vnd.android.package-archive"); context.startActivity(intent); }
From source file:Main.java
public static void Instanll(File file, Context context) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(android.content.Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); context.startActivity(intent);/*from ww w .j a va 2s . c o m*/ }
From source file:Main.java
public static void instanll(File file, Context context) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); context.startActivity(intent);//from w w w. j av a 2 s .c o m }
From source file:Main.java
static void passDownload(String linkToDownload, String SAVE, String notificationTitle, String fileName, String fileType, String userName, Context mContext) { Intent downloadIntent = new Intent(); downloadIntent.setPackage("com.ihelp101.instagram"); downloadIntent.setAction("com.ihelp101.instagram.PASS"); downloadIntent.putExtra("URL", linkToDownload); downloadIntent.putExtra("SAVE", SAVE); downloadIntent.putExtra("Notification", notificationTitle); downloadIntent.putExtra("Filename", fileName); downloadIntent.putExtra("Filetype", fileType); downloadIntent.putExtra("User", userName); mContext.startService(downloadIntent); }
From source file:Main.java
public static void installApk(Context context, File file) { if (context == null) return;// w w w . j a v a2 s . com if (file == null) return; Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); context.startActivity(intent); }