List of usage examples for android.content Context startActivity
public abstract void startActivity(@RequiresPermission Intent intent);
From source file:Main.java
public static void goPage(Context context, Class<?> gopage, String extraName, String extraValue) { Intent intent = new Intent(context, gopage); intent.putExtra(extraName, extraValue); context.startActivity(intent); }
From source file:Main.java
/** * Restart application (just relauch the first page of package) * * * @param context Context// w ww .ja v a 2s . c o m */ public static void restartApplication(Context context) { final Intent intent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName()); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); context.startActivity(intent); }
From source file:Main.java
public static void startApplication(Context mContext, String packageName) throws Exception { PackageManager packageManager = mContext.getPackageManager(); Intent intent = packageManager.getLaunchIntentForPackage(packageName); mContext.startActivity(intent); }
From source file:be.ac.ucl.lfsab1509.llncampus.ExternalAppUtility.java
/** * Open a browser with the URI specified. * // w w w .j ava 2s. co m * @param context * Application context. * @param uri * The URI. */ public static void openBrowser(Context context, Uri uri) { Intent intent = new Intent(Intent.ACTION_VIEW, uri); context.startActivity(intent); }
From source file:Main.java
public static void openMyAppInfo(Context mContext) { Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); Uri uri = Uri.fromParts(SCHEME, mContext.getPackageName(), null); intent.setData(uri);// ww w . j a v a 2 s.c om mContext.startActivity(intent); }
From source file:Main.java
public static void delayToActivity(final Context context, final Class<?> cls, long delay) { Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override/*from w w w . ja v a 2 s . com*/ public void run() { context.startActivity(new Intent(context, cls)); } }, delay); }
From source file:Main.java
public static void startActivityByClassName(Context mContext, String className) { try {/*from ww w . ja v a 2s .c om*/ Intent intent = new Intent(); intent.setClass(mContext, Class.forName(className)); mContext.startActivity(intent); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void jumpToActivity(Context context, Class<?> cls, Bundle bundle) { Intent jumpIntent = new Intent(); if (bundle != null) jumpIntent.putExtras(bundle);//from w w w . j av a2 s .c o m jumpIntent.setClass(context, cls); context.startActivity(jumpIntent); }
From source file:Main.java
public static void startActivity(Context packageContext, Class<?> cls, String personId) { Intent intent = new Intent(packageContext, cls); if (personId != "") { intent.putExtra("personId", personId); }/*from w ww .j a v a2s . com*/ packageContext.startActivity(intent); }
From source file:Main.java
public static void changeScreenintent(@NonNull Context CurrentActivity, @NonNull Class NextActivity) { checkNotNull(CurrentActivity);/*from w w w .java 2s. c om*/ checkNotNull(NextActivity); Intent intent = new Intent(CurrentActivity, NextActivity); CurrentActivity.startActivity(intent); }