Export a picture to internal memory of the mobilephone

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
razvan
Posts: 19
Joined: Tue Feb 24, 2015 10:16 am

Export a picture to internal memory of the mobilephone

Post by razvan » Thu Jul 23, 2015 10:19 am

Hi!Maybe is banal but how can export a image from app to a folder from internal memory of the mobilephone(Android)?I want a simple example.
Thank you!

JacobS
Posts: 58
Joined: Mon Aug 20, 2012 8:41 pm
Location: Indiana, United States

Re: Export a picture to internal memory of the mobilephone

Post by JacobS » Thu Jul 23, 2015 1:06 pm

Hi Razvan,

Check out the forum thread viewtopic.php?f=7&t=20444.
It's got a good explanation of how to take a picture, put it on the stack of the app, and then export that image to the mobile phone's internal memory.

Hope that helps,
Jacob

razvan
Posts: 19
Joined: Tue Feb 24, 2015 10:16 am

Re: Export a picture to internal memory of the mobilephone

Post by razvan » Fri Jul 24, 2015 7:26 am

Thank you JacobS!
mobileExportImageToAlbum don't working in my case or i don't use correct this function.

I found this code on the forum and this one working well.

Code: Select all

on mouseUp
   set the defaultFolder to "/mnt/sdcard/DCIM/"
   put image "myImage" into url("binfile:picTest.jpg")
   answer the result
end mouseUp

pkocsis
Posts: 105
Joined: Sat Apr 15, 2006 7:20 am

Re: Export a picture to internal memory of the mobilephone

Post by pkocsis » Wed Jul 29, 2015 11:49 pm

Hello Razvan,

The problem with simply putting the image into url("binfile:picTest.jpg") is that Android is not notified to rescan the receiving folder, and therefore the gallery app will not "see" the new pic until Android rescans. This is not a great workaround to mobileExportImageToAlbum for apps that wish to allow users to see deposited photos instantly in their gallery app since the app would have to inform the user: "OK, now reboot your phone to see the photo in your gallery app" :?

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7230
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Export a picture to internal memory of the mobilephone

Post by jacque » Thu Jul 30, 2015 4:11 pm

The Android rescan issue doesn't just affect LiveCode, it's pretty common for many apps. I downloaded a small utility that does a rescan so I don't have to reboot the device. I'm using Rescan Media but there are probably others. It's such a common problem that my old Archos tablet had a button in its system prefs to rescan.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

pkocsis
Posts: 105
Joined: Sat Apr 15, 2006 7:20 am

Re: Export a picture to internal memory of the mobilephone

Post by pkocsis » Thu Jul 30, 2015 9:29 pm

Hi Jacque,

Is the reason its common for many apps because:

A) android doesn't provide an api call to tell the OS it needs to rescan

----OR----

B) Other folks writing apps with the native android api's simply neglect making the rescan api call? (laziness on their part)

....I ask because *if* the answer is "B", then LiveCode is deficient in providing a way to let android know it needs to rescan and the fact that other developers wrote apps that simply neglect to make the call doesn't really exonerate LiveCode from not having the functionality.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7230
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Export a picture to internal memory of the mobilephone

Post by jacque » Thu Jul 30, 2015 9:47 pm

I don't know. There must be some way to do it, but it might be some tricky thing these utilites use that isn't strictly an API. As far as I know, the only time the device does a rescan natively is on reboot, and otherwise you need to manually force it. You could try researching how that happens.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Android Deployment”