I use the following xml structure: (All layers are fullscreen)

  1. RelativeLayout - layout_1 (Visible)
  2. CurlView - layout_2 (Visible)
  3. RelativeLayout - layout_3 (Visible)
  4. CurlView - layout_4 (Visible)
  5. RelativeLayout - layout_5 (Visible)

Algorithm # 1:

  1. Hide layout_5, layout_4 => On the screen layout_3
  2. We are waiting for user action.
  3. Hide layout_3, layout_2 => On the screen layout_1.
  4. Display layout_5.

Algorithm # 2:

  1. Hide layout_5 => On the screen layout_4.
  2. We are waiting for user action.
  3. Display layout_5.

Algorithm # 1 works flawlessly, in Algorithm # 2, during execution of step 3, flickering occurs in the form of a short-term layout_3 display (several ms), although everything else is fine.

Code used for p.3:

layout_4.setVisibility(CurlView.INVISIBLE); layout_5.setVisibility(RelativeLayout.VISIBLE); 

I will be glad to any help, thanks in advance.

  • one
    Why don't you use different activites for different layers? Just wondering. - Yura Ivanov
  • one
    and better fragments .. - Gorets
  • As a last resort, why use Invisible, but not Gone? - Lucky_spirit
  • one
    Thanks for answers. The application has to work with the database, in particular - to update the database, it should be done from launch to release in a separate thread. And to the same database you need to make requests from the main thread. (Immediately the question: how to implement it, because there is a question of speed and simultaneous access to the database). These 5 layers are related to the fact that the effect of turning over a sheet of paper is used; for this, it is necessary that the next layer is under the CurlPage. How to implement it otherwise can not imagine. Any ideas? I use CurlPage by Harism - andgo75
  • one
    I think you need to use fragments. - Lucky_spirit

1 answer 1

@ Andgo75 , in general, I can give you such advice. Use the fragments in order to separate the work of individual parts from the work of the Activity, and in order to perform this all on the main UI thread, I use the RunOnUiThread function. What you define inside it will be 100% executed in the main thread. Something like this.

  • Thanks, I will try! - andgo75