List of usage examples for android.app Activity startActivity
@Override public void startActivity(Intent intent)
From source file:Main.java
/** * Start System Activity./*ww w . j ava2 s . c om*/ * Display Toast with the message if activity not available * @param activity- {@link Activity} instance * @param action - String representing {@link Settings} * @param altToastMessage - Message to be displayed in Toast if {@link Activity} not available */ public static void startSystemActivity(Activity activity, String action, String altToastMessage) { Intent locationIntent = new Intent(action); if (locationIntent.getAction() != null) { activity.startActivity(locationIntent); } else { if (altToastMessage != null) { showToast(activity, altToastMessage); } } }
From source file:Main.java
public static void installApk(Activity activity, String path) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(path)), "application/vnd.android.package-archive"); activity.startActivity(intent); }
From source file:Main.java
public static <T extends Activity> void start(Activity caller, Class<T> activityClass, Bundle params) { Intent intent = new Intent(caller, activityClass); if (params != null) { intent.putExtras(params);/*from ww w. j a va 2 s. co m*/ } caller.startActivity(intent); }
From source file:Main.java
public static void playVideo(String url, Activity activity) { if (url != null && url.length() > 0) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(url), "video/*"); activity.startActivity(intent); }//from w w w . j av a2s.c o m }
From source file:Main.java
public static void startPackage(Activity activity, String s, String s1, Bundle bundle) { Intent intent = new Intent(); intent.setComponent(new ComponentName(s, s1)); intent.putExtras(bundle);/*from w ww .j ava2s . com*/ activity.startActivity(intent); }
From source file:com.org.icsfoodapp.OrderTabsPagerFragmentActivity.java
public static void start(Activity activity) { activity.startActivity(new Intent().setClass(activity, OrderTabsPagerFragmentActivity.class)); }
From source file:Main.java
public static boolean onKeyBackGoHome(Activity activity, int keyCode, KeyEvent event) { if (!(keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0)) { return false; // continue }/*from w ww . j a v a2s. c o m*/ activity.startActivity(new Intent().setAction(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME)); return true; }
From source file:Main.java
public static void startActivityWithNoData(Activity start, Activity from, Class<Activity> end) { if (start == null || from == null || end == null) return;/* www . j ava 2 s . c o m*/ Intent intent = new Intent(); intent.setClass(from, end); start.startActivity(intent); }
From source file:Main.java
public static void CloseActivity(Activity activity, Class<?> class1) { Intent intent = new Intent(activity, class1); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); activity.startActivity(intent); }
From source file:Main.java
public static void openURL(Activity activity, String url) { Intent intent = new Intent(); intent.setAction("android.intent.action.VIEW"); Uri content_url = Uri.parse(url);/* w ww . j a v a2 s.c o m*/ intent.setData(content_url); activity.startActivity(intent); }