我是PhoneGap Android开发人员的新手。我正在使用phonegap在android中创建一个应用程序。我想从设备相机拍照,然后我想在从设备拍摄图像后将其显示在屏幕上,并将拍摄的图像存储在SD卡中。你能告诉我怎么做吗?
Gurpreet singh
答案 0 :(得分:4)
答案 1 :(得分:4)
用于保存SD卡......
function save(){
document.addEventListener("deviceready", onDeviceReady, false);
}
// PhoneGap is ready
//
function onDeviceReady() {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
}
function gotFS(fileSystem) {
fileSystem.root.getFile("pic.jpg", {create: true, exclusive: false}, gotFileEntry, fail);
}
function gotFileEntry(fileEntry) {
fileEntry.createWriter(gotFileWriter, fail);
}
function gotFileWriter(writer) {
var photo = document.getElementById("image");
writer.write(photo.value);
}
function fail(error) {
console.log(error.code);
}