Forum Xamarin.Forms

Switch MainPage causes images to be reload (flickering effect)

ignacio.salvoignacio.salvo USMember
edited July 2016 in Xamarin.Forms

Hi,
I have a Page "A" with six images and a page "B" with other information (labels, etc). My app is a XF and running on Android. All images are PNG files optimized for size which I use in the above Content Pages using XF Image view. I keep instances of both pages in memory.

At startup I set "Application.Current.MainPage" to Page "A" and then switch to Page "B". Both pages show without problems. However, when I switch back from page "B" to page "A" all images seem to be reloaded. This happens for about 1 to 2 seconds, and it basically causes a weird effect.

Is there a way to avoid this from happening?

It seems XF is refreshing page A layout and reloading resource images. Not sure why, this should only happen the first time. Page A is already in memory by the time I switch from page B to A.

Thanks,
Ignacio

Posts

  • rogiheerogihee NLMember ✭✭✭

    I experience the same problem, still wanting to investigate.

  • KymPhillpotts.3866KymPhillpotts.3866 AUXamarin Team, University, XamUProfessors Xamurai

    Not sure about the flickering when changing MainPage, however, could you instead be popping Page B Modally over Page A and then dismissing it to go back to Page A?

  • rogiheerogihee NLMember ✭✭✭

    No I have 3 tabbed pages and on the simulator it is really re-loading the images and choking.

    The output keeps spitting stuff like this:

    07-18 10:26:12.121 E/eglCodecCommon( 1950): glUtilsParamSize: unknow param 0x00000b44
    07-18 10:26:12.163 E/eglCodecCommon( 1950): glUtilsParamSize: unknow param 0x00000bd0
    07-18 10:26:12.189 E/eglCodecCommon( 1950): **** ERROR unknown type 0x0 (glSizeof,72)
    07-18 10:26:12.201 E/eglCodecCommon( 1950): glUtilsParamSize: unknow param 0x00000b44
    07-18 10:26:12.212 E/eglCodecCommon( 1950): glUtilsParamSize: unknow param 0x00000bd0
    07-18 10:26:12.235 E/eglCodecCommon( 1950): **** ERROR unknown type 0x0 (glSizeof,72)
    07-18 10:26:12.278 E/eglCodecCommon( 1950): glUtilsParamSize: unknow param 0x00000b44
    07-18 10:26:12.286 E/eglCodecCommon( 1950): glUtilsParamSize: unknow param 0x00000bd0

    On a real device nothing happens. But it is strange, it is just a view with with about 12 images in it.

  • rogiheerogihee NLMember ✭✭✭

    Also this:
    07-18 10:29:43.779 I/chromium( 1950): [INFO:CONSOLE(6)] "The value "300;" for key "width" was truncated to its numeric prefix.", source: file:///android_asset/ (6)
    07-18 10:29:43.779 I/chromium( 1950): [INFO:CONSOLE(6)] "The value "1.0;" for key "initial-scale" was truncated to its numeric prefix.", source: file:///android_asset/ (6)
    07-18 10:29:43.779 I/chromium( 1950): [INFO:CONSOLE(6)] "The value "1.0;" for key "maximum-scale" was truncated to its numeric prefix.", source: file:///android_asset/ (6)
    07-18 10:29:43.779 I/chromium( 1950): [INFO:CONSOLE(6)] "The value "0;" for key "user-scalable" was truncated to its numeric prefix.", source: file:///android_asset/ (6)
    07-18 10:29:43.779 I/chromium( 1950): [INFO:CONSOLE(6)] "Error parsing a meta element's content: ';' is not a valid key-value pair separator. Please use ',' instead.", source: file:///android_asset/ (6)
    07-18 10:29:43.780 I/chromium( 1950): [INFO:CONSOLE(6)] "The value "300;" for key "width" was truncated to its numeric prefix.", source: file:///android_asset/ (6)
    07-18 10:29:43.780 I/chromium( 1950): [INFO:CONSOLE(6)] "The value "1.0;" for key "initial-scale" was truncated to its numeric prefix.", source: file:///android_asset/ (6)
    07-18 10:29:43.780 I/chromium( 1950): [INFO:CONSOLE(6)] "The value "1.0;" for key "maximum-scale" was truncated to its numeric prefix.", source: file:///android_asset/ (6)
    07-18 10:29:43.780 I/chromium( 1950): [INFO:CONSOLE(6)] "The value "0;" for key "user-scalable" was truncated to its numeric prefix.", source: file:///android_asset/ (6)
    07-18 10:29:43.780 I/chromium( 1950): [INFO:CONSOLE(6)] "Error parsing a meta element's content: ';' is not a valid key-value pair separator. Please use ',' instead.", source: file:///android_asset/ (6)
    07-18 10:29:43.780 I/Choreographer( 1950): Skipped 34 frames! The application may be doing too much work on its main thread.

  • ignacio.salvoignacio.salvo USMember

    I actually have more than two pages, so putting a modal screen over the other is not really a solution. The flickering effect is due to the various images being loaded one after another after the page is already up. What I'm wondering is why XF have to re-load images when going back to a page that has been used already? Is there a way to simply set "Application.Current.MainPage"and avoid the page re-layout from happening. It seems that that is what's happening.

Sign In or Register to comment.