Refresh the parent activity view before moving on to it

I have a main action that triggers another action, let me call it A2. When A2 finishes loading, it fires an event that updates the appearance of the main activity. This works great.

The problem is that when I click back or end () in A2 and it starts the transition animation back to the main activity, the main activity does not seem to have been redrawn before the animation starts, since the slides in it still have old layout. When the transition is completed, it updates what it should be.

Is there a way to make the main view of an action invalidate its presentation or otherwise make it redraw its view before the transition so that the animation looks beautiful and smooth? I tried invalidate() , but it does not redraw until the transition occurs.

(To avoid the XY problem: as part of a complex animation from the main activity to A2, I create and disappear as a black overlay in the main action. When A2 is onResume (), it sends the navigation a completed event that forces the main process to remove the overlay. When returning from A2 this overlay is still displayed, so it looks like it goes into a black screen until the transition is complete and the view is displayed again.)

+5
source share

Source: https://habr.com/ru/post/1200166/


All Articles