Android Question Select Image from device

aaronk

Well-Known Member
Licensed User
Longtime User
Hello,

I am using the ContentChooser in my project like below:

B4X:
Sub Process_Globals
   Dim chooser As ContentChooser
End Sub
 
Sub Activity_Create(FirstTime AsBoolean)
If FirstTime Then
   chooser.Initialize("chooser")
End If
   chooser.Show("image/*", "Choose image")
End Sub
 
Sub chooser_Result (Success AsBoolean, Dir AsString, FileName AsString)
If Success Then
   Dim bmp As Bitmap
    bmp.Initialize(Dir, FileName)
    main_panel.SetBackgroundImage(bmp) ' panels background based on image selected
  
Else
    ToastMessageShow("No image selected", True)
End If
End Sub

I then added the following code to the chooser_Result sub..
B4X:
 File.Copy(Dir, FileName, File.DirInternal, "background.png")

The question I have is how can I search the 'File.DirInternal' location for images (rather than the gallery location) since this is where I am copying the file to?

The reason I copied the image to a different location is because if the user adds the image as the background in my app and I save that location, if the user then deletes the image from the gallery location, the image would then be gone and won't be able to be loaded once they run my app again.
 

Itila Tumer

Active Member
Licensed User
Longtime User
Hi, when It research for photos, I click back .and then there happens an error. about intialize Object.
How could I fix it
 

Attachments

  • Err.PNG
    Err.PNG
    97.7 KB · Views: 432
Upvote 0
Top