我使用的是诺基亚 3120,我想将捕获的图像保存在手机内存中,但当我保存图像时,它给出异常安全 Java/lang/SecurityException
访问被拒绝。
我的代码,
FileConnection fileConn = null;
DataOutputStream dos = null;
try {
fileConn = (FileConnection) Connector.open(
"file:///C:/story123.jpg"); /*//"file:///root1/story123.jpeg");*/
if (!fileConn.exists()) {
fileConn.create();
}
dos = new DataOutputStream(fileConn.openOutputStream());
dos.write(photo);
dos.flush();
dos.close();
fileConn.close();
} catch (IOException ioe) {
System.out.println("Error!" + ioe);
}
最佳答案
J2ME 非常严格。手机可能不允许在文件系统的根文件夹中存储某些内容。 尝试找到图像文件夹并将其存储在那里。
您可以通过以下方式获取目录
System.getProperty("fileconn.dir.photos")
另请参阅 FileConnection API system properties in the Symbian platform and Series 40
关于netbeans - 如何将捕获的图像保存在图库文件夹或手机内存中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10796730/