Android Question load bitmap

ANGELINE ROMAN

Member
Licensed User
The sample shown below does not display the image.What is wrong?
B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private Button1 As Button
    Private ImageView1 As ImageView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Dim b As Bitmap
    If File.Exists(File.DirRootExternal,"1.jpg") = True Then
        ImageView1.Initialize("")
        ImageView1.Bitmap=LoadBitmap(File.DirRootExternal,"1.jpg")
        'ImageView1.Bitmap=bg
        'ImageView1.im 'iBackground=b
    End If
    Activity.LoadLayout("sketch")
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
Asuming the Imageview is part of the Layout

B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("sketch")
    If File.Exists(File.DirRootExternal,"1.jpg") = True Then
        ImageView1.Bitmap=LoadBitmap(File.DirRootExternal,"1.jpg")
    End If
End Sub
 
Upvote 0
Top