Hi,
How do i add the title of each picture to below the picture in the image view?
The following code loads the images from the program folder and then loads them into the image view.
I want to add the file name to display under each picture.
<code>Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then 'only load the images once.
ProgressDialogShow("Loading images")
LoadImages
ProgressDialogHide
End If
btmpex.Initialize("BitmapExtended")
Activity.LoadLayout("Page4") 'load the layout file
scvPics.Panel.Height = 200dip * Bitmaps.Size 'Set the inner panel height according to the number of images.
For i = 0 To Bitmaps.Size - 1
Dim iv As ImageView 'create an ImageView for each bitmap
iv.Initialize("") 'not interested in any events so we pass empty string.
Dim bd As BitmapDrawable
bd.Initialize(Bitmaps.Get(i))
bd2 = bd.Bitmap
bd3 = btmpex.rotateBitmap(bd2,90)
iv.bitmap = bd3 'set the background of the image view.
'add the image view to the scroll bar internal panel.
scvPics.Panel.AddView(iv, 5dip, 5dip + i * 200dip, scvPics.Width - 10dip, 190dip)
Next
End Sub
Sub LoadImages
Bitmaps.Initialize
Dim files As List
Dim imagesFolder As String
imagesFolder = File.DirDefaultExternal
If File.Exists(imagesFolder, "") = False Then
ToastMessageShow("Images folder not found: " & CRLF & imagesFolder, True)
Return
End If
files = File.ListFiles(imagesFolder) 'get all files in this folder
For i = 0 To files.Size - 1
DoEvents 'required for the ProgressDialog animation
Dim f As String
f = files.Get(i)
If f.ToLowerCase.EndsWith(".jpg") Then
Dim b As Bitmap
b.InitializeSample(imagesFolder, f, 200dip, 200dip) 'load the jpeg file and subsample it if it is too large.
Bitmaps.Add(b) 'add the bitmap to the bitmaps list.
If Bitmaps.Size > 500 Then Exit 'limit it to 50 images
End If
Next
ToastMessageShow("Found " & Bitmaps.Size & " images", True)
End Sub
How do i add the title of each picture to below the picture in the image view?
The following code loads the images from the program folder and then loads them into the image view.
I want to add the file name to display under each picture.
<code>Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then 'only load the images once.
ProgressDialogShow("Loading images")
LoadImages
ProgressDialogHide
End If
btmpex.Initialize("BitmapExtended")
Activity.LoadLayout("Page4") 'load the layout file
scvPics.Panel.Height = 200dip * Bitmaps.Size 'Set the inner panel height according to the number of images.
For i = 0 To Bitmaps.Size - 1
Dim iv As ImageView 'create an ImageView for each bitmap
iv.Initialize("") 'not interested in any events so we pass empty string.
Dim bd As BitmapDrawable
bd.Initialize(Bitmaps.Get(i))
bd2 = bd.Bitmap
bd3 = btmpex.rotateBitmap(bd2,90)
iv.bitmap = bd3 'set the background of the image view.
'add the image view to the scroll bar internal panel.
scvPics.Panel.AddView(iv, 5dip, 5dip + i * 200dip, scvPics.Width - 10dip, 190dip)
Next
End Sub
Sub LoadImages
Bitmaps.Initialize
Dim files As List
Dim imagesFolder As String
imagesFolder = File.DirDefaultExternal
If File.Exists(imagesFolder, "") = False Then
ToastMessageShow("Images folder not found: " & CRLF & imagesFolder, True)
Return
End If
files = File.ListFiles(imagesFolder) 'get all files in this folder
For i = 0 To files.Size - 1
DoEvents 'required for the ProgressDialog animation
Dim f As String
f = files.Get(i)
If f.ToLowerCase.EndsWith(".jpg") Then
Dim b As Bitmap
b.InitializeSample(imagesFolder, f, 200dip, 200dip) 'load the jpeg file and subsample it if it is too large.
Bitmaps.Add(b) 'add the bitmap to the bitmaps list.
If Bitmaps.Size > 500 Then Exit 'limit it to 50 images
End If
Next
ToastMessageShow("Found " & Bitmaps.Size & " images", True)
End Sub