When call activity.recreate(
), there is a black screen (for 0.5 second). I don't know where it comes from since it was working fine on other devices
Asked
Active
Viewed 3,422 times
15
-
1See https://stackoverflow.com/a/52331896/4168607. – ADM May 21 '19 at 10:58
2 Answers
-2
use this
finish();
startActivity(getIntent());

Mohamed Mo'nes
- 420
- 3
- 14
-
1It works but remember to free resources in the onDestroy method or you can get OutOfMemory Exception – user2342558 Jul 19 '19 at 06:49
-
but this does not help in a situation where you already have a stack of fragment loaded, this will recreate the activity but you lose the back stacks of the fragment .... – MRX Oct 30 '20 at 08:24
-2
try this
- draw root view on bitmap
- start second activity displaying that bitmap using custom fade animation
- recreate first activity with delay = duration of fade animation
- finish second activity

Ярослав Нестеров
- 161
- 1
- 8