androidanimationandroid-activityandroid-transitionsshared-element-transition

Activity transition shared animation background bug


I have a bug when using transition between activities by using a shared element.

  1. I'm using sample ActivitySceneTransitionBasic .

  2. Add delay before navigation.

new Handler().postDelayed(() -> {
          ActivityCompat.startActivity(MainActivity.this, intent, activityOptions.toBundle());
    }, 2000);
  1. Turn screen off.

There is no bug if activity open without turn screen off.

The New Activity opens without background (like on screenshot) or with glitches. Can you help to solve this bug?


Solution

  • First, I recommend you go to the modern implementation of the sample, found at

    https://github.com/android/animation-samples/tree/main/ActivitySceneTransitionBasic

    It was moved over and made a part of the bulk "animations samples" group about 2 years ago. If samples are old, Google tends to be pretty sketchy about keeping them updated. And they keep deprecating and moving to different locations.

    The main animation samples are here:

    https://github.com/android/animation-samples

    And if you have issues (or found an actual bug) you can file GitHub concerns with them at:

    https://github.com/android/animation-samples/issues

    There is also this tutorial at Google in their tutorial series, this discusses "Starting an Activity Using an Animation"

    https://developer.android.com/develop/ui/views/animations/transitions/start-activity

    Quite a bit larger depth and it has Java / Kotlin side-by-sides.

    If there's still an issue with turning-off the phone, during the transition, then maybe I might be able to help further.