#Region Module Attributes
#FullScreen: False
#IncludeTitle: True
#ApplicationLabel: Text zum Bild
#VersionCode: 2
#VersionName:
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: True
#End Region
Sub Process_Globals
Private xui As XUI
Private rp As RuntimePermissions
Dim Bitmaps As List
Public Verz As String
End Sub
Sub Globals
Dim bText As String
Dim Scv As ScrollView
Private Button1 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result = True Then Verz= File.DirRootExternal
Log("Zugriff auf Verzeichnisstruktur: " & Result)
If Result=False Then xui.MsgboxAsync("Der Zugriff auf den Bildpfad ist fehlerhaft.","Fehler")
Verz = "storage/0096-1800/DCIM/Camera" ' An eigene Gegebenheiten anpassen!
bText="Das ist der Text, welcher beim 1. Start unter dem Bild zu lesen ist ."
Activity.LoadLayout("Scroll")
BilderLaden
Show
End Sub
Sub Show
Scv.Panel.Height = 300dip * Bitmaps.Size
For i = Bitmaps.Size - 1 To 0 Step -1
Dim iv As ImageView
Dim LB As Label
iv.Initialize("IVC")
LB.Initialize("LBC")
LB.Text =bText & I
LB.Tag="TAG Nr: " & I
Dim bd As BitmapDrawable
bd.Initialize(Bitmaps.Get(i))
iv.Background = bd
iv.Tag ="HUHU"& I
Scv.Panel.AddView(iv, 5dip, 5dip + i * 300dip, Scv.Width - 10dip, 190dip)
Scv.Panel.AddView(LB, 5dip, 205dip + i *300dip, Scv.Width - 10dip, 100dip)
Next
End Sub
Sub BilderLaden
Bitmaps.Initialize
Dim Bilder As List
Dim BildOrdner As String
BildOrdner = Verz
If File.Exists(BildOrdner, "") = False Then
ToastMessageShow("Bildpfad fehlerhaft: " , False)
Return
End If
Bilder.Initialize
Bilder = File.ListFiles(BildOrdner)
For i = 0 To Bilder.Size - 1
Dim f As String
f = Bilder.Get(i)
If f.ToLowerCase.EndsWith(".jpg") Then
Dim b As Bitmap
b.InitializeSample(BildOrdner, f, 200dip, 200dip)
Bitmaps.Add(b)
If Bitmaps.Size > 10 Then Exit
End If
Next
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
bText="Das ist ein neuer Text"
BilderLaden
Show
ToastMessageShow ("Hm funktioniert nicht",True)
End Sub