Android Question Show progressbar when loading a bitmap

appie21

Active Member
Licensed User
Longtime 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?

B4X:
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
 

sorex

Expert
Licensed User
Longtime User
you can use the standard progress dialogue to indicate it's doing something

B4X:
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
 
Upvote 0

JohnK

Active Member
Licensed User
Longtime User
Hi

I have do that but without resuilt ( i did not see the progressbar)
The progress dialogue needs "DoEvents" between the show and hide. "The more the merrier", but it slows down the actual app.
 
Last edited:
Upvote 0
Top