10

I have two activities both having a GoogleAPIClient which is used to login. Now what happens is when I go to the 2nd activity by means of the first activity, then I log in on the 1st activity, which is the one on screen, the app crashes. When I don't go from one activity to another, nothing crashes. Coincidentally, this only happens on the first activity. I went from 1st-2nd-1st-2nd then logged in on the 2nd activity and it did not crash.

Here is my LogCat :

09-09 14:03:32.192    968-13080/? A/ActivityManager﹕ Activity Manager Crash
java.lang.IllegalArgumentException
        at com.android.server.am.ActivityManagerService.isTopOfTask(ActivityManagerService.java:11223)
        at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:1629)
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2606)
        at com.android.server.am.ActivityManagerServiceEx.onTransact(ActivityManagerServiceEx.java:448)
        at android.os.Binder.execTransact(Binder.java:446)
09-09 14:03:32.200  31715-31715/<MyPackage> E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: <MyPackage>, PID: 31715
    java.lang.IllegalArgumentException
            at android.os.Parcel.readException(Parcel.java:1544)
            at android.os.Parcel.readException(Parcel.java:1493)
            at android.app.ActivityManagerProxy.isTopOfTask(ActivityManagerNative.java:4517)
            at android.app.Activity.isTopOfTask(Activity.java:5448)
            at android.app.Activity.startActivityForResult(Activity.java:3857)
            at android.app.Activity.startActivity(Activity.java:4090)

I think it crashes on this line of code on my util class that initializes an activity with animations

public static void startActivityWithAnimations(Activity activity, Intent intent, AnimationUtils.ANIM_STYLE animationStyle) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Bundle animation = ActivityOptions.makeSceneTransitionAnimation(activity).toBundle();
        **activity.startActivity(intent, animation);**
    } else {
        activity.startActivity(intent);
        activity.overridePendingTransition(animationStyle.getEnterAnim(), animationStyle.getExitAnim());
    }
}

Looking at the Activity class I think it crashes on this line of code :

private boolean isTopOfTask() {
    try {
        **return ActivityManagerNative.getDefault().isTopOfTask(mToken);**
    } catch (RemoteException e) {
        return false;
    }
}
John Ernest Guadalupe
  • 6,379
  • 11
  • 38
  • 71

0 Answers0