Android Question How to load image from my mobile phone ?

IslamQabel

Active Member
Licensed User
Longtime User
Dear All:

I am asking about loading image from my mobile photos? ...... i just checked on help but all loading ways is by only Loadbitmap(File.DirAssets,"anyimage.bmp")......the image should be stored inside File folder in project file......
.....

I am making some ImageView objects in the layout by designer...........and i want just when i click the image view load the image from mobile....like browsing for the location of image
 

Mahares

Expert
Licensed User
Longtime User
The photos I take using my device's camera as stored in File.DirRootExternal/DCIM/Camera folder. Yours, probably the same way. You can then do this:
Dim imageview1 as Imageview 'in Globals
B4X:
Sub imageview1_Click
     imageview1.SetBackgroundImage(LoadBitmap(File.DirRootExternal & "/DCIM/Camera","photoname.jpg"))
End Sub
 
Upvote 0

IslamQabel

Active Member
Licensed User
Longtime User
Anybody know how to load image from SD card of mobile?
i tried the root "/sdcard/DCIM/Camera" but it did not work.....
 
Upvote 0

IslamQabel

Active Member
Licensed User
Longtime User
i tried this code and it is working for images saved in the SD card
B4X:
 ImageView1.SetBackgroundImage(LoadBitmap(File.DirRootExternal & "/external_sd/DCIM/Camera","name.jpg"))

and the code Mahares is needed when you load the image from phone memory
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…