App doesn't load all the jpgs

mr_onionmr_onion Member ✭✭
edited February 13 in Xamarin.Forms

Hi there guyz. This is my first question here. I've encountered a problem concerning jpgs in my Xamarin.Forms app. Since there is no nice way of displaying pdf in Xamarin i've split my pdf file into jpg images. On my emulator all the images are shown, but on some other devices - not all of them, only a few. Maybe someone has a clue of what's going on?
P.S. Images are in the drawable folder and all set to "Android Resource"

Tagged:

Answers

  • DarshanJSDarshanJS USMember ✭✭✭✭

    @mr_onion said:

    check what property you have given for images whether it is aspect fit or fill. changed those and try

  • mr_onionmr_onion Member ✭✭

    @DarshanJS tried all aspects - still some are loading, others are not. The most interesting part is that on firrst launch several pics are loaded, on second - different several pics. Tried converting to png, still same issue

  • PaulNTUPaulNTU USMember ✭✭✭

    I wonder if its a memory issue and garbage collector is cleaning up your loaded images. You could try two things

    1) Check if reducing the size of each Jpeg is feasible, if you have large Jpegs then they will need more memory when loaded.
    2) Increase the Java Max Heap Size for your android app
    i. Go to your android project properties, in Android Options tab click advanced
    ii. Enter 1G into the Java Max Heap Size box (This is an experiment you can change this value to suite your needs if it works)
    iii. Do a clean and rebuild and see if it makes any difference

  • DipakPatilDipakPatil Member ✭✭

    I am 100% sure it's because of the big size image.
    1) reduce image size first.
    #delete those particular image from drawable folder or resource folder
    # then compress images and then add again them in the resources folder.
    # then use "FFimage CachedImage" option to bind images.

    and if you don't want to compress image because of clear visibility then just use "FFimage CachedImage" nuget and bind image with it.
    this link can be helpful : https://www.c-sharpcorner.com/article/xamarin-forms-ffimageloading-app2/

  • DipakPatilDipakPatil Member ✭✭

    also, you can use pdf in xamarin forms.
    this link can be useful :
    https://acaliaro.wordpress.com/2017/11/30/open-a-pdf-inside-a-webview-in-xamarin-forms-android/

Sign In or Register to comment.