List of usage examples for android.content Context startActivity
public abstract void startActivity(@RequiresPermission Intent intent);
From source file:Main.java
public static void startMessageActivity(Context context) { Intent it = new Intent(Intent.ACTION_VIEW); it.putExtra("sms_body", "The SMS text"); it.setType("vnd.android-dir/mms-sms"); context.startActivity(it); }
From source file:Main.java
public static void callNum(Context context, String number) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_CALL); intent.setData(Uri.parse("tel:" + number)); context.startActivity(intent); }
From source file:Main.java
public static void callNumWithDial(Context context, String number) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:" + number)); context.startActivity(intent); }
From source file:Main.java
@SuppressWarnings("unused") public static void launchApk(Context context, String launchApkUrl) { PackageManager pm = context.getPackageManager(); Intent intent = pm.getLaunchIntentForPackage(launchApkUrl); context.startActivity(intent); }
From source file:Main.java
public static void showInputMethodSettingsPage(Context context) { Intent intent = new Intent(Settings.ACTION_INPUT_METHOD_SETTINGS); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
From source file:Main.java
public static void launchActivity(Context context, Class<?> activity, Bundle bundle) { Intent intent = new Intent(context, activity); intent.putExtras(bundle);/* w ww.j av a 2 s.c o m*/ context.startActivity(intent); }
From source file:Main.java
public static void uninstall(Context context) { Uri packageURI = Uri.parse("package:" + context.getPackageName()); Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI); context.startActivity(uninstallIntent); }
From source file:Main.java
public static void startActivity(Context context, String packageName) { Intent intent = context.getPackageManager().getLaunchIntentForPackage(packageName); if (intent != null) { context.startActivity(intent); }// w w w . java2 s .c om }
From source file:Main.java
public static void callPhone(Context context, String number) { Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(URL_TEL + number)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
From source file:Main.java
public static void startXiaomiApp(Context context) { Intent intent = context.getPackageManager().getLaunchIntentForPackage("com.xiaomi.smarthome"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }