TransitionDrawable causing ANR in android

47 views Asked by At

im having an issue with TransitionDrawable class in android causing an ANR in strict mode. Here is the method call causing the ANR:

private void crossFadeImages(Drawable imageToFadeOut, Drawable imageToFadeIn) {
    TransitionDrawable td = new TransitionDrawable( new Drawable[] {
            imageToFadeOut,
            imageToFadeIn
    });
    m_myimageView.setImageDrawable(td);
    td.startTransition(200);
}

i am passing two drawables. the imageToFadeOut has the following specs:

337X599 PNG (32-bit color) 93.85KB

and the imageToFadeIn has the following specs:

337X599 PNG (32-bit color) 395.16KB

and the ANR is being caused in a nexus 5 emulator api 19 xxhdpi. The actual ANR shows up in strict mode mostly.

i get the following log error

"I/Choreographer: Skipped 33 frames! The application may be doing too much work on its main thread."

the method is called from the main thread. How can i resolve this ? Or is there another way to do the cross fading between two images ?

0

There are 0 answers