Home » Android » java – When using activity.recreate() screen flashes black for 0,5 secs

java – When using activity.recreate() screen flashes black for 0,5 secs

Posted by: admin June 15, 2020 Leave a comment

Questions:

When using activity.recreate() screen flashes black for 0,5 secs, is there anyways you can solve this so it doesen’t blink. Or make the whole screen fadeout to black before using activity.recreate()?

How to&Answers:

Try to make 2 layouts, 1 with hiidden views and the other has all elements visible, and use setContentView(layoutId); to switch between them, if you have listeners on UI elements move the set listeners from onCraete() to onResume() and call it upon layout switching