List of usage examples for android.content Context startActivity
public abstract void startActivity(@RequiresPermission Intent intent);
From source file:Main.java
public static void enableDiscoverable(Context paramContext) { Intent localIntent = new Intent("android.bluetooth.adapter.action.REQUEST_DISCOVERABLE"); localIntent.putExtra("android.bluetooth.adapter.extra.DISCOVERABLE_DURATION", 300); paramContext.startActivity(localIntent); }
From source file:Main.java
public static void sendSMS(final Context context, String message) { final Intent sendIntent = new Intent(Intent.ACTION_VIEW); sendIntent.putExtra("sms_body", message); sendIntent.setType("vnd.android-dir/mms-sms"); context.startActivity(sendIntent); }
From source file:Main.java
public static void link(Context context, String url) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory(Intent.CATEGORY_BROWSABLE); intent.setData(Uri.parse(url));//from w ww . ja v a 2s . c o m context.startActivity(intent); }
From source file:Main.java
public static void openAPK(Context context, String pkgName) { PackageManager packageManager = context.getPackageManager(); Intent intent = new Intent(); intent = packageManager.getLaunchIntentForPackage(pkgName); context.startActivity(intent); }
From source file:Main.java
public static void sendMessage(Context context, String number, String message) { Uri uri = Uri.parse("smsto:" + number); Intent sendIntent = new Intent(Intent.ACTION_VIEW, uri); sendIntent.putExtra("sms_body", message); context.startActivity(sendIntent); }
From source file:Main.java
static void saveToContact(Context context, String number) { Intent intent = new Intent(Contacts.Intents.Insert.ACTION, Contacts.People.CONTENT_URI); intent.putExtra(Contacts.Intents.Insert.PHONE, number); context.startActivity(intent); }
From source file:Main.java
public static void uninstallAppbyPackageName(Context context, String packageName) { Uri uri = Uri.parse("package:" + packageName); Intent intent = new Intent(Intent.ACTION_DELETE, uri); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
From source file:Main.java
public static void startActivityWithNewTask(@NonNull Context context, @NonNull Class className) { Intent intent = new Intent(context, className); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); context.startActivity(intent); }
From source file:Main.java
public static void openURL(final Context ctx, final String url) { final Intent i2 = new Intent(Intent.ACTION_VIEW); i2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i2.setData(Uri.parse(url));/*from www . ja v a2 s.c om*/ ctx.startActivity(i2); }
From source file:Main.java
public static void openAppInfo(Context context, String packageName) { Intent intent = new Intent(); intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS"); intent.setData(Uri.parse("package:" + packageName)); context.startActivity(intent); }