15

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

ADM
  • 20,406
  • 11
  • 52
  • 83
Mizz
  • 151
  • 1
  • 4

2 Answers2

-2

use this

finish();
startActivity(getIntent());
Mohamed Mo'nes
  • 420
  • 3
  • 14
  • 1
    It 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

  1. draw root view on bitmap
  2. start second activity displaying that bitmap using custom fade animation
  3. recreate first activity with delay = duration of fade animation
  4. finish second activity