Skip to content

Instantly share code, notes, and snippets.

@lzyzsd
Forked from yagitoshiro/gist:1247519
Created May 13, 2013 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lzyzsd/5566928 to your computer and use it in GitHub Desktop.
Save lzyzsd/5566928 to your computer and use it in GitHub Desktop.
save_button.addEventListener('click', ()->
if Ti.Filesystem.isExternalStoragePresent
save_image = Ti.Filesystem.getFile(path).read()
new_path = Titanium.Filesystem.externalStorageDirectory + Date.now().toString() + ".png"
f = Ti.Filesystem.getFile(new_path)
result = f.write(save_image)
unless result
return null
callback_fn = (e)->
Ti.API.info e
if e.uri
message = L('saved')
else
message = L('error')
alert message
return
Ti.Media.Android.scanMediaFiles([new_path], null, callback_fn)
return
)
@lzyzsd
Copy link
Author

lzyzsd commented May 13, 2013

Titanium save image to photo gallery on android

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment