List of usage examples for android.content Context startActivity
public abstract void startActivity(@RequiresPermission Intent intent);
From source file:Main.java
public static void startNewActivity(Context context, Class<?> clazz) { Intent intent = new Intent(context, clazz); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
From source file:Main.java
public static void showMarketPublish(Context context, String publish) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("market://search?q=pub:" + publish)); context.startActivity(intent); }
From source file:Main.java
public static final void startActivity(final Context context, final Class clazz) { if (intent == null) { intent = new Intent(); }/*from www .jav a 2 s . c o m*/ intent.setClass(context, clazz); context.startActivity(intent); }
From source file:Main.java
public static void openGooglePlayForApp(Context context, String namespace) { Intent inPlay = new Intent(Intent.ACTION_VIEW); inPlay.setData(Uri.parse("market://details?id=" + namespace)); context.startActivity(inPlay); }
From source file:Main.java
/** * Simply opens browser with a regular intent. * /*w w w .j ava 2 s . c om*/ * @param ctx * context to use * @param uri * url top open */ public static void open(final Context ctx, final String uri) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(uri)); ctx.startActivity(intent); }
From source file:Main.java
public static void startActivity(Context context, Class<?> clazz) { Intent intent = new Intent(context, clazz); intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); context.startActivity(intent); }
From source file:Main.java
public static void searchApp(Context context, String packageName) { Uri uri = Uri.parse("market://search?q=" + packageName); Intent intent = new Intent(Intent.ACTION_VIEW, uri); context.startActivity(intent); }
From source file:Main.java
public static boolean startAPP(Context context, String appPackageName) { try {//from w ww . j av a 2 s. com Intent intent = context.getPackageManager().getLaunchIntentForPackage(appPackageName); context.startActivity(intent); return true; } catch (Exception e) { return false; } }
From source file:Main.java
public static void uninstallApp(Context context, String appPackageName) { Intent intent = new Intent(Intent.ACTION_DELETE); intent.setData(Uri.parse("package:" + appPackageName)); context.startActivity(intent); }
From source file:Main.java
/** * Propose user to uninstall the given application * * @param context/*from w w w . j a v a 2 s. co m*/ * @param packageName package of the application to uninstall */ public static void uinstallApplication(final Context context, final String packageName) { final Intent intent = new Intent(Intent.ACTION_DELETE, Uri.fromParts("package", packageName, null)); context.startActivity(intent); }