Hi all,
With the code below, no error is shown but no image is recorded on the selected file on application "barcode.png" .
Can anyone help me?
I'm using :
Samsung GT-I8530 OSX 10.9.4 Android SDK 20 Titanium 3.3.0 GA
var win;
function fireUpTheCamera() {
var imageView;
Titanium.Media.showCamera({
success:function(event)
{
var cropRect = event.cropRect;
// var image = event.media;
event.media.nativePath = 'file:///mnt/sdcard/Pictures/CamKit/barcode.png';
Ti.API.info('Our type was: '+event.mediaType);
if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO)
{
imageView = Ti.UI.createImageView({
width:win.width,
height:win.height,
image:event.media
});
win.add(imageView);
}
else
{
alert("got the wrong type back ="+event.mediaType);
}
},
cancel:function()
{
},
error:function(error)
{
// create alert
var a = Ti.UI.createAlertDialog({
title:'Camera'
});
// set message
if (error.code == Ti.Media.NO_CAMERA)
{
a.setMessage('Please run this test on device');
}
else
{
a.setMessage('Unexpected error: ' + error.code);
}
// show alert
a.show();
},
saveToPhotoGallery:true,
allowEditing:true,
mediaTypes:[Ti.Media.MEDIA_TYPE_PHOTO]
});
}
win = Ti.UI.createWindow({
// title:_args.title
});
if (Ti.Platform.osname === 'android')
{
win.addEventListener('open', function(e)
{
fireUpTheCamera();
});
}
else
{
fireUpTheCamera();
}
win.open();