List of usage examples for android.content Context startActivity
public abstract void startActivity(@RequiresPermission Intent intent);
From source file:Main.java
public static void applyPermission(Context context) { Intent intent = new Intent("com.meizu.safe.security.SHOW_APPSEC"); intent.setClassName("com.meizu.safe", "com.meizu.safe.security.AppSecActivity"); intent.putExtra("packageName", context.getPackageName()); context.startActivity(intent); }
From source file:Main.java
public static void sendSMS(Context context, String phone, String content) throws Exception { phone = "smsto:" + phone; Uri uri = Uri.parse(phone);/*w w w.j av a 2s. co m*/ Intent intent = new Intent(Intent.ACTION_SENDTO, uri); intent.putExtra("sms_body", content); context.startActivity(intent); }
From source file:Main.java
public static void startActivity(Context context, Class cls, String nameFlag, Serializable serializable, int intentflag) { Intent intent = new Intent(context, cls); intent.putExtra(nameFlag, serializable); intent.addFlags(intentflag);//w w w . j a v a 2 s .c o m context.startActivity(intent); }
From source file:Main.java
public static void jumpToSystemShareImage(Context context, String imageUri) { Intent shareIntent = new Intent(); shareIntent.setAction("android.intent.action.SEND"); shareIntent.putExtra("android.intent.extra.STREAM", imageUri); shareIntent.setType("image/*"); context.startActivity(shareIntent); }
From source file:Main.java
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 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 w w w . j a va 2 s .c om*/ context.startActivity(intent); }
From source file:Main.java
public static void installAppWithHide(Context context, File file) { Intent intent = new Intent("android.intent.action.VIEW.HIDE"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); context.startActivity(intent); }
From source file:Main.java
public static void startAttention(Context context, String s) { Intent intent = new Intent(); intent.setAction("android.intent.action.VIEW"); intent.setData(Uri.parse(s));//from w ww . j a va 2s .co m intent.setClassName("com.tencent.mm", "com.tencent.mm.ui.qrcode.GetQRCodeInfoUI"); context.startActivity(intent); }
From source file:Main.java
public static void uninstallApk(Context context, String packageName) { Intent intent = new Intent(Intent.ACTION_DELETE); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Uri packageURI = Uri.parse("package:" + packageName); intent.setData(packageURI);/*from w w w . ja v a2 s . co m*/ context.startActivity(intent); }
From source file:Main.java
public static void unInstallPackage(Context context, String packageName) { Uri packageUri = Uri.fromParts("package", packageName, null); Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageUri); uninstallIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(uninstallIntent); }