1

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?

Zain
  • 37,492
  • 7
  • 60
  • 84
Denis
  • 2,622
  • 3
  • 22
  • 24

1 Answers1

0

try increasing the delay time to 5000

 new Handler().postDelayed(() -> {
      ActivityCompat.startActivity(MainActivity.this, intent, 
 activityOptions.toBundle());
  }, 5000);

or try to delay the turning off of the screen until after the transition is complete by using setExitSharedElementCallback() method to set a callback that is triggered when the shared element transition is finished, and use this callback to turn off the screen.

Nadeem
  • 53
  • 12
  • How can i delay turning off the screen? It's user action. Delay turning off the screen it's bad for user experience. – Denis Jan 25 '23 at 11:00