List of usage examples for android.content Context startActivity
public abstract void startActivity(@RequiresPermission Intent intent);
From source file:Main.java
@Deprecated public static void uninstallApk2(Context context, String packageName) { Intent intent = new Intent(Intent.ACTION_DELETE); Uri packageURI = Uri.parse("package:" + packageName); intent.setData(packageURI);//from w ww .j a v a2s . co m context.startActivity(intent); }
From source file:Main.java
public static void openApplicationOnGooglePlay(Context context, String packageName) { try {/* w w w . jav a2s . com*/ Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("market://details?id=" + packageName)); context.startActivity(intent); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:Main.java
/** * Open the google play store market with this app * /*from w w w .j a va 2 s . co m*/ * @param context the application context */ public static void openMarket(Context context) { Uri uri = Uri.parse("market://details?id=" + context.getPackageName()); Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri); try { context.startActivity(goToMarket); } catch (ActivityNotFoundException e) { Toast.makeText(context, "Couldn't launch the market", Toast.LENGTH_SHORT).show(); } }
From source file:Main.java
public static void startPhone(Context context, String phoneNumber) { Intent intent = new Intent(Intent.ACTION_DIAL); // intent.setAction(Intent.ACTION_CALL); intent.setData(Uri.parse("tel:" + phoneNumber)); context.startActivity(intent); }
From source file:Main.java
public static void installApk(Context context, String filename) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(filename)), "application/vnd.android.package-archive"); context.startActivity(intent); }
From source file:Main.java
public static void installApk(Context context, String filePath) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(filePath)), "application/vnd.android.package-archive"); context.startActivity(intent); }
From source file:Main.java
public static void installRemoteAPK(Context context, String packageName) { Uri installUri = Uri.fromParts("package", packageName, null); Intent intent = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri); context.startActivity(intent); }
From source file:Main.java
public static Boolean sendSms(Context mContext, String smstext) { Uri smsToUri = Uri.parse("smsto:"); Intent mIntent = new Intent(Intent.ACTION_SENDTO, smsToUri); mIntent.putExtra("sms_body", smstext); mContext.startActivity(mIntent); return null;/*from ww w .j a va2 s .c o m*/ }
From source file:Main.java
public static void installApkWithPrompt(File apkFile, Context context) { Intent promptInstall = new Intent(Intent.ACTION_VIEW); promptInstall.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive"); context.startActivity(promptInstall); }
From source file:Main.java
/** * Activity Not Finish Jump/*from ww w . j av a2 s.c om*/ */ public static void gotoActivityNotFinishWithExtras(Context context, Class<?> actClass, Bundle bundle) { Intent intent = new Intent(context, actClass); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }