I am having issues saving image to local application files in Titanium. Specifically creating file from event.media;
function handleImageEvent(event) {
imgpreview.image = event.media;
var imaget = event.media;
var f = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,imagename);
f.write(imaget);
}
//imagename : I am using in the format of 'photo0.png'
Here's the code I have so far that I have tried to put together and test through my own search, they do not work. exception were thrown
[WARN] : TextView: TextView does not support text selection. Action mode cancelled.
[ERROR] : TiFileProxy: (KrollRuntimeThread) [5233,84017] IOException encountered
[ERROR] : TiFileProxy: java.io.IOException: read only
[ERROR] : TiFileProxy: at org.appcelerator.titanium.io.TiResourceFile.write(TiResourceFile.java:100)
[ERROR] : TiFileProxy: at org.appcelerator.titanium.TiFileProxy.write(TiFileProxy.java:286)
[ERROR] : TiFileProxy: at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
[ERROR] : TiFileProxy: at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)
[ERROR] : TiFileProxy: at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:884)
[ERROR] : TiFileProxy: at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1107)
[ERROR] : TiFileProxy: at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:347)
[ERROR] : TiFileProxy: at android.os.Handler.dispatchMessage(Handler.java:95)
[ERROR] : TiFileProxy: at android.os.Looper.loop(Looper.java:137)
[ERROR] : TiFileProxy: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)
I hope I can provide more details, but I am at lost, apologies Thanks in advance.