Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to delay hiding a transition image in android

I am working on this task and I want to delay hiding this imageView until another view is loaded. So currently the problem is there is a split where it’s just displaying a dark screen as it waits for it to load which looks back. I tried using a handler but

private fun animationFromPointA() {
     val transImageView = findViewById<ImageView>(R.id.trans_image_view)
   
         Glide.with(this)
             .load(file)
            // I have removed the onLoadFailed and onResourceReady
             .into(transImageView)

    
 }

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I think a more effective approach will be to listen to the view being drawn . When the view gets drawn you hide this view ..that was there is no dependency on the time.

The way to do this is

final LinearLayout layout = (LinearLayout) findViewById(R.id.YOUR_VIEW_ID);(use your own layout)
    ViewTreeObserver vto = layout.getViewTreeObserver(); 
    vto.addOnGlobalLayoutListener (new OnGlobalLayoutListener() { 
        @Override 
        public void onGlobalLayout() {
    
         // Put your imageview visibility code here
        } 
    });
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading