钛:从Android的相机/相册保存图像文件在本地 [英] Titanium: Saving file locally from Android's Camera/Gallery image

查看:199
本文介绍了钛:从Android的相机/相册保存图像文件在本地的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有保存图像本地应用程序文件中钛的问题。
特别是从event.media创建文件;

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'

这里的code我到目前为止,我已经试图通过我自己的搜索放在一起测试,
他们不工作。异常被抛出

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)

[错误]:TiFileProxy:在org.appcelerator.kroll.KrollRuntime $ KrollRuntimeThread.run(KrollRuntime.java:112)

[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.

推荐答案

Titanium.Filesystem.resourcesDirectory 是只读的。请找到所有位置的列表,包括在<一个的访问权限href=\"http://docs.appcelerator.com/titanium/latest/#!/guide/Filesystem_Access_and_Storage-section-29004902_FilesystemAccessandStorage-Storagelocations\" rel=\"nofollow\">http://docs.appcelerator.com/titanium/latest/#!/guide/Filesystem_Access_and_Storage-section-29004902_FilesystemAccessandStorage-Storagelocations

Titanium.Filesystem.resourcesDirectory is read-only. Please find a list of all location, including the access rights at http://docs.appcelerator.com/titanium/latest/#!/guide/Filesystem_Access_and_Storage-section-29004902_FilesystemAccessandStorage-Storagelocations

这篇关于钛:从Android的相机/相册保存图像文件在本地的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆