public void startActivity(Intent intent, int animationEnterId, int animationLeaveId) { Activity activity = this; activity = TinyUtils.getRootActivity(this); if (activity == this) { super.startActivity(intent); } else { activity.startActivity(intent); } try { if (Integer.parseInt(android.os.Build.VERSION.SDK) > 4 && animationEnterId > 0 && animationLeaveId > 0) { Reflector.callMethod(activity, "overridePendingTransition", new Class<?>[] { int.class, int.class }, new Object[] { animationEnterId, animationLeaveId }); } } catch (Exception ex) { } }
public class TinyUtils { public static Activity getRootActivity(Activity activity) { Activity parent; while ((parent = activity.getParent()) != null) { activity = parent; } return activity; } }