Android Question Show progressbar when loading a bitmap

Discussion in 'Android Questions' started by appie21, Aug 27, 2015.

  1. appie21

    appie21 Active Member Licensed User

    Hello

    I have made a photo viewer

    When a user click on a next button a new set of images will be loaded
    But some times the images are big and it take a moment to load

    how can i set a progressbar when the image is loaded, and disapear when the image is loaded succesfull?

    Code:
    If Blznr = 0 Then
           
            ImgVBlad1.Bitmap = 
    LoadBitmap(File.DirAssets, "1.png")
            ImgVBlad2.Bitmap = 
    LoadBitmap(File.DirAssets, "2.png")
            BtnVorige.Visible = 
    False
           
    Else if Blznr <= 1 Then   
           
            BtnVorige.Visible = 
    True
            ImgVBlad1.Bitmap = 
    LoadBitmap(File.DirAssets, "3.png")
            ImgVBlad2.Bitmap = 
    LoadBitmap(File.DirAssets, "4.png")
       
    End if
     
  2. sorex

    sorex Expert Licensed User

    you can use the standard progress dialogue to indicate it's doing something

    Code:
    ProgressDialogShow("Loading image...")
    If Blznr = 0 Then
            ImgVBlad1.Bitmap = 
    LoadBitmap(File.DirAssets, "1.png")
            ImgVBlad2.Bitmap = 
    LoadBitmap(File.DirAssets, "2.png")
            BtnVorige.Visible = 
    False
    Else if Blznr <= 1 Then  
            BtnVorige.Visible = 
    True
            ImgVBlad1.Bitmap = 
    LoadBitmap(File.DirAssets, "3.png")
            ImgVBlad2.Bitmap = 
    LoadBitmap(File.DirAssets, "4.png")
    End if
    ProgressDialogHide
     
    koaunglay likes this.
  3. appie21

    appie21 Active Member Licensed User

    Hi

    I have do that but without resuilt ( i did not see the progressbar)
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Use LoadBitmapSample and it will load the image quickly (on a real device).
     
    appie21 likes this.
  5. JohnK

    JohnK Active Member Licensed User

    The progress dialogue needs "DoEvents" between the show and hide. "The more the merrier", but it slows down the actual app.
     
    Last edited: Aug 29, 2015
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice