Hi All,
Having a problem with imgPicture.SetBackgroundImage
I use this code to select a picture and then save the path and file name into a database
This "imgPicture.SetBackgroundImage(LoadBitmap(PictureDir,PictureName))" works perfectly
I then retrieve the Path and filename and try to re-load the picture when moving through the database record and it fails!
As you can see I output the Dir and filename to the log and they are identical to what was saved but I get this error
I am testing in the emulator when this fails, anyone any ideas?
Steve
P.S. These are the Dir and Filename from the log
>ContentDir>
>content://com.android.providers.media.documents/document/image%3A7>
Having a problem with imgPicture.SetBackgroundImage
I use this code to select a picture and then save the path and file name into a database
B4X:
Sub btnPicture_Click
Dim Chooser As ContentChooser
If Chooser.IsInitialized = False Then
Chooser.Initialize("chooser")
End If
Chooser.Show("image/*", "Select an image")
End Sub
Sub chooser_Result (Success As Boolean, Dir As String, FileName As String)
If Success Then
PictureName = FileName
PictureDir = Dir
Log(">" & PictureDir & ">" )
Log(">" & PictureName & ">" )
imgPicture.SetBackgroundImage(LoadBitmap(PictureDir,PictureName))
Else
ToastMessageShow("No image selected", True)
End If
End Sub
This "imgPicture.SetBackgroundImage(LoadBitmap(PictureDir,PictureName))" works perfectly
I then retrieve the Path and filename and try to re-load the picture when moving through the database record and it fails!
B4X:
PictureName = Cursor1.GetString("PictureName")
PictureDir = Cursor1.GetString("PictureDir")
If(PictureName <>"" ) Then
Log(">" & PictureDir & ">" )
Log(">" & PictureName & ">" )
imgPicture.SetBackgroundImage(LoadBitmap(PictureDir,PictureName))
End If
Cursor1.Close
As you can see I output the Dir and filename to the log and they are identical to what was saved but I get this error
B4X:
java.io.FileNotFoundException: content:/com.android.providers.media.documents/document/image%3A7/ContentDir: open failed: ENOENT (No such file or directory)
I am testing in the emulator when this fails, anyone any ideas?
Steve
P.S. These are the Dir and Filename from the log
>ContentDir>
>content://com.android.providers.media.documents/document/image%3A7>
Last edited: