我想捕捉使用相机的图像并将其放入android屏幕。我正在使用sencha touch 2,phonegap用于相机功能。它正在捕获图像但不显示在屏幕上。 这里是我的代码:使用相机拍摄图像后,照片不返回到我的屏幕
在dashboardpanel文件:
{
xtype : 'image',
id : 'capturedimage',
src : '',
width : 60,
height: 60,
width : 200
},
{
xtype : 'container',
id : 'btncontainer',
width : 120,
layout : {
type : 'vbox'
},
items : [
{
xtype : 'button',
height : 73,
cls : 'capturebtn',
id : 'capturebtn',
width : 100
},
{
xtype : 'button',
height : 73,
margin : '10 0 0 0',
cls : 'choosephotobtn',
id : 'selectphoto',
width : 100
} ]
},
在Controller文件::
onCaptureButtonTap: function(button, e, options) {
/**
* phonegap Camera
*/
navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 20, allowEdit: true });
function onFail(message) {
alert('Failed because: ' + message);
}
function onPhotoDataSuccess(imageData) {
// Uncomment to view the base64 encoded image data
console.log(imageData);
// Get image handle
//
var smallImage = document.getElementById('capturedimage');
// Unhide image elements
//
smallImage.style.display = 'block';
// Show the captured photo
// The inline CSS rules are used to resize the image
//
smallImage.src = imageData;
}
}
但它不来了。请问任何人可以帮我...
你看到'adb logcat'输出中的任何错误? – dhaval
不,它没有给出任何logcat错误。 –
你检查了@Simon的最后一条评论以打印成功的输出 – dhaval