List of usage examples for android.app Activity startActivity
@Override public void startActivity(Intent intent)
From source file:Main.java
public static boolean onKeyBackGoHome(Activity activity, int i, KeyEvent keyEvent) { if (i != 4 || keyEvent.getRepeatCount() != 0) { return false; }//from w w w. j a v a2 s . c o m activity.startActivity( new Intent().setAction("android.intent.action.MAIN").addCategory("android.intent.category.HOME")); return true; }
From source file:Main.java
public static final void invokeWithArgs(Activity activity, Class<?> clazz, Bundle bundle) { Intent intent = new Intent(activity, clazz); intent.putExtra("bundle", bundle); activity.startActivity(intent); }
From source file:Main.java
public static boolean openApp(Activity activity, String action) { try {//from w w w . j av a 2s .co m Intent intent = new Intent(); intent.setAction(action); activity.startActivity(intent); return true; } catch (Exception e) { e.printStackTrace(); return false; } }
From source file:Main.java
public static void sendMessage(Activity activity, String phone) { Uri uri = Uri.parse("smsto:" + phone); Intent intent = new Intent(Intent.ACTION_SENDTO, uri); activity.startActivity(intent); }
From source file:Main.java
public static void animTo(Activity activity, Class<?> toClass, int enterAnim, int exitAnim) { Intent intent = new Intent(); intent.setClass(activity, toClass);/*w ww.ja v a 2 s . c o m*/ activity.startActivity(intent); activity.overridePendingTransition(enterAnim, exitAnim); }
From source file:Main.java
public static void startActivity(Activity activity, Class<? extends Activity> target) { if (activity != null) { Intent intent = new Intent(activity, target); activity.startActivity(intent); }//w ww . ja v a 2 s . c o m }
From source file:Main.java
public static void gotoMarket(Activity activity) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("market://details?id=com.bitime.emoji")); activity.startActivity(intent); }
From source file:Main.java
public static void goHome(Activity parent) { Intent i = new Intent(parent, Main.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP + Intent.FLAG_ACTIVITY_NEW_TASK); parent.startActivity(i); }
From source file:Main.java
public static void startActivityForStringData(Activity activity, String name, Class<?> cls, String data) { Intent intent = new Intent(activity, cls); intent.putExtra(name, data);/*from w w w. ja va 2 s .c o m*/ activity.startActivity(intent); }
From source file:Main.java
public static void startActivityForSerializable(Activity context, Class<?> cls, Serializable data) { Intent intent = new Intent(context, cls); intent.putExtra("Serializable", data); context.startActivity(intent); }