Hi Everyone,
I noticed that if I try to load a layout to ask the user to wait while coding to write to storage executes. Immediately after the code to load the layout is the coding to write to storage. The layout does not get displayed until the code that writes to storage finishes. Is there a way around this issue?
I also tried using ProgressDialogShow in hopes that it would keep the dialog showing prior to the storage writing code but the same problem occurs.
Here is the coding I'm using:
I noticed that if I try to load a layout to ask the user to wait while coding to write to storage executes. Immediately after the code to load the layout is the coding to write to storage. The layout does not get displayed until the code that writes to storage finishes. Is there a way around this issue?
I also tried using ProgressDialogShow in hopes that it would keep the dialog showing prior to the storage writing code but the same problem occurs.
Here is the coding I'm using:
B4X:
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
LoadMainLayout
ProgressDialogShow("Please wait while the images are loaded...")
' Activity.LoadLayout("PleaseWait")
' PanelPleaseWait.SetBackgroundImage(LoadBitmap(File.DirAssets, "hourglass.jpg"))
' PanelPleaseWait.Top = 0
' PanelPleaseWait.Left = 0
' PanelPleaseWait.Height = Activity.Height
' PanelPleaseWait.Width = Activity.Width
' PanelPleaseWait.Visible = True
' Create a map of photos (key = name, value = image)
' This will be loaded into an UltraListView.
'---------------------------------------------------
Photos.Initialize
Photos.Put("One of the 7 masjids", LoadBitmapSample(File.DirAssets, "IMG_0320.jpg", 50dip, 50dip))
Photos.Put("The Jamarat", LoadBitmapSample(File.DirAssets, "IMG_0367.jpg", 50dip, 50dip))
Photos.Put("Makka - Roof of Masjid", LoadBitmapSample(File.DirAssets, "IMG_0270.jpg", 50dip, 50dip))
Photos.Put("Uhud - Masjid", LoadBitmapSample(File.DirAssets, "IMG_0327.jpg", 50dip, 50dip))
Photos.Put("Masjid Kuba", LoadBitmapSample(File.DirAssets, "IMG_0325.jpg", 50dip, 50dip))
Photos.Put("Uhud - Graves", LoadBitmapSample(File.DirAssets, "IMG_0328.jpg", 50dip, 50dip))
Photos.Put("Kabba - The black stone", LoadBitmapSample(File.DirAssets, "IMG_0278.jpg", 50dip, 50dip))
Photos.Put("Maqam-e-Ibrahim", LoadBitmapSample(File.DirAssets, "IMG_0272.jpg", 50dip, 50dip))
Photos.Put("Bus to Makka", LoadBitmapSample(File.DirAssets, "IMG_0221.jpg", 50dip, 50dip))
Photos.Put("Hajj terminal", LoadBitmapSample(File.DirAssets, "IMG_0375.jpg", 50dip, 50dip))
Photos.Put("Muzdalifah - Salat", LoadBitmapSample(File.DirAssets, "IMG_0361.jpg", 50dip, 50dip))
Photos.Put("Mina - Transportation", LoadBitmapSample(File.DirAssets, "IMG_0357.jpg", 50dip, 50dip))
Photos.Put("Mina - Tents", LoadBitmapSample(File.DirAssets, "IMG_0350.jpg", 50dip, 50dip))
Photos.Put("Mina - Where we sleep", LoadBitmapSample(File.DirAssets, "IMG_0349.jpg", 50dip, 50dip))
Photos.Put("Changing of the Quibla", LoadBitmapSample(File.DirAssets, "IMG_0337.jpg", 50dip, 50dip))
Photos.Put("Masjid Kuba 1", LoadBitmapSample(File.DirAssets, "IMG_0335.jpg", 50dip, 50dip))
Photos.Put("Uhud - Quran revealed", LoadBitmapSample(File.DirAssets, "IMG_0329.jpg", 50dip, 50dip))
Photos.Put("Kaba - Day time", LoadBitmapSample(File.DirAssets, "IMG_0273.jpg", 50dip, 50dip))
Photos.Put("Kaba - Night time", LoadBitmapSample(File.DirAssets, "IMG_0261.jpg", 50dip, 50dip))
Photos.Put("Madina - Day time", LoadBitmapSample(File.DirAssets, "IMG_0308.jpg", 50dip, 50dip))
Photos.Put("Arafat - About to climb", LoadBitmapSample(File.DirAssets, "IMG_0251.jpg", 50dip, 50dip))
Photos.Put("Madina - Inside", LoadBitmapSample(File.DirAssets, "IMG_0310.jpg", 50dip, 50dip))
Photos.Put("Masjid Kuba 2", LoadBitmapSample(File.DirAssets, "IMG_0324.jpg", 50dip, 50dip))
Photos.Put("Arafat - At the top", LoadBitmapSample(File.DirAssets, "IMG_0254.jpg", 50dip, 50dip))
Photos.Put("Muzdalifah - Night time", LoadBitmapSample(File.DirAssets, "IMG_0362.jpg", 50dip, 50dip))
Photos.Put("Makka - Duah", LoadBitmapSample(File.DirAssets, "IMG_0285.jpg", 50dip, 50dip))
Photos.Put("Madina - Roof of Masjid", LoadBitmapSample(File.DirAssets, "IMG_0312.jpg", 50dip, 50dip))
intTotalPhotosInList = Photos.Size
' Put the photo list into storage.
' Later on this will be used to get image titles and image file names.
'---------------------------------------------------------------------
kvsPhotoList.Initialize(File.DirDefaultExternal, "avPhotoList", Photos.Size)
kvsPhotoList.DeleteAll
' 1st parameter is the key.
' 2nd parameter is the index.
' 3rd parameter is the value.
'
' 1st set for index 0 value contains the photo title.
' 2nd set for index 1 value contains the photo image file name.
'--------------------------------------------------------------
kvsPhotoList.PutSimple1("0", 0, "One of the 7 masjids")
kvsPhotoList.PutSimple1("0", 1, "IMG_0320.jpg")
kvsPhotoList.PutSimple1("1", 0, "The Jamarat")
kvsPhotoList.PutSimple1("1", 1, "IMG_0367.jpg")
kvsPhotoList.PutSimple1("2", 0, "Makka - Roof of Masjid")
kvsPhotoList.PutSimple1("2", 1, "IMG_0270.jpg")
kvsPhotoList.PutSimple1("3", 0, "Uhud - Masjid")
kvsPhotoList.PutSimple1("3", 1, "IMG_0327.jpg")
kvsPhotoList.PutSimple1("4", 0, "Masjid Kuba")
kvsPhotoList.PutSimple1("4", 1, "IMG_0325.jpg")
kvsPhotoList.PutSimple1("5", 0, "Uhud - Graves")
kvsPhotoList.PutSimple1("5", 1, "IMG_0328.jpg")
kvsPhotoList.PutSimple1("6", 0, "Kabba - The black stone")
kvsPhotoList.PutSimple1("6", 1, "IMG_0278.jpg")
kvsPhotoList.PutSimple1("7", 0, "Maqam-e-Ibrahim")
kvsPhotoList.PutSimple1("7", 1, "IMG_0272.jpg")
kvsPhotoList.PutSimple1("8", 0, "Bus to Makka")
kvsPhotoList.PutSimple1("8", 1, "IMG_0221.jpg")
kvsPhotoList.PutSimple1("9", 0, "Hajj terminal")
kvsPhotoList.PutSimple1("9", 1, "IMG_0375.jpg")
kvsPhotoList.PutSimple1("10", 0, "Muzdalifah - Salat")
kvsPhotoList.PutSimple1("10", 1, "IMG_0361.jpg")
kvsPhotoList.PutSimple1("11", 0, "Mina - Transportation")
kvsPhotoList.PutSimple1("11", 1, "IMG_0357.jpg")
kvsPhotoList.PutSimple1("12", 0, "Mina - Tents")
kvsPhotoList.PutSimple1("12", 1, "IMG_0350.jpg")
kvsPhotoList.PutSimple1("13", 0, "Mina - Where we sleep")
kvsPhotoList.PutSimple1("13", 1, "IMG_0349.jpg")
kvsPhotoList.PutSimple1("14", 0, "Changing of the Quibla")
kvsPhotoList.PutSimple1("14", 1, "IMG_0337.jpg")
kvsPhotoList.PutSimple1("15", 0, "Masjid Kuba 1")
kvsPhotoList.PutSimple1("15", 1, "IMG_0335.jpg")
kvsPhotoList.PutSimple1("16", 0, "Uhud - Quran revealed")
kvsPhotoList.PutSimple1("16", 1, "IMG_0329.jpg")
kvsPhotoList.PutSimple1("17", 0, "Kaba - Day time")
kvsPhotoList.PutSimple1("17", 1, "IMG_0273.jpg")
kvsPhotoList.PutSimple1("18", 0, "Kaba - Night time")
kvsPhotoList.PutSimple1("18", 1, "IMG_0261.jpg")
kvsPhotoList.PutSimple1("19", 0, "Madina - Day time")
kvsPhotoList.PutSimple1("19", 1, "IMG_0308.jpg")
kvsPhotoList.PutSimple1("20", 0, "Arafat - About to climb")
kvsPhotoList.PutSimple1("20", 1, "IMG_0251.jpg")
kvsPhotoList.PutSimple1("21", 0, "Madina - Inside")
kvsPhotoList.PutSimple1("21", 1, "IMG_0310.jpg")
kvsPhotoList.PutSimple1("22", 0, "Masjid Kuba 2")
kvsPhotoList.PutSimple1("22", 1, "IMG_0324.jpg")
kvsPhotoList.PutSimple1("23", 0, "Arafat - At the top")
kvsPhotoList.PutSimple1("23", 1, "IMG_0254.jpg")
kvsPhotoList.PutSimple1("24", 0, "Muzdalifah - Night time")
kvsPhotoList.PutSimple1("24", 1, "IMG_0362.jpg")
kvsPhotoList.PutSimple1("25", 0, "Makka - Duah")
kvsPhotoList.PutSimple1("25", 1, "IMG_0285.jpg")
kvsPhotoList.PutSimple1("26", 0, "Madina - Roof of Masjid")
kvsPhotoList.PutSimple1("26", 1, "IMG_0312.jpg")
'' PanelPleaseWait.Visible = False
ProgressDialogHide
End If
LoadPreviousState
Select strNameOfCurrentActivity
Case "main"
LoadMainLayout
Case "settings"
LoadSettingsLayout
End Select
intTotalPhotosInList = 27
End Sub