Fixing a possible flickering of notification when switching between activities