1- i can't save the picture into sd card
2- i can't add taken image to imageview
this problem in both ios and android
the code
Titanium.Media.showCamera({
success:function(event)
{
var cropRect = event.cropRect;
var image = event.media;
var f = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'camera_photo.png');
f.write(image);
$.fuckoff.backgroundImage = f.nativePath;
Ti.API.info('------------ Camera SUCCESS');
var myImageView = Titanium.UI.createImageView({ image: f.nativePath, backgroundColor: "#000000"});
myImageView.height = 300;
myImageView.width = 300;
$.index.add(myImageView);
Ti.API.info('------------ Camera SUCCESS222');
},
cancel:function()
{
},
error:function(error)
{
// create alert
var a = Titanium.UI.createAlertDialog({title:'Camera'});
// set message
if (error.code == Titanium.Media.NO_CAMERA)
{
a.setMessage('Device does not have video recording capabilities');
}
else
{
a.setMessage('Unexpected error: ' + error.code);
}
// show alert
a.show();
},
allowEditing:true
});
__________________________________________________________
and the error
[INFO] : dalvikvm:
[ERROR] : TiDrawableReference: (pool-3-thread-2) [70,672] Unable to load bitmap. Not enough memory: null
[ERROR] : TiDrawableReference: java.lang.OutOfMemoryError
[ERROR] : TiDrawableReference: at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
[ERROR] : TiDrawableReference: at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:623)
[ERROR] : TiDrawableReference: at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:324)
[ERROR] : TiDrawableReference: at org.appcelerator.titanium.util.TiLoadImageManager$LoadImageJob.run(TiLoadImageManager.java:128)
[ERROR] : TiDrawableReference: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
[ERROR] : TiDrawableReference: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
[ERROR] : TiDrawableReference: at java.lang.Thread.run(Thread.java:841)
[INFO] : Choreographer: Skipped 36 frames! The application may be doing too much work on its main thread.
[INFO] : ------------ Camera SUCCESS222
[WARN] : IInputConnectionWrapper: showStatusI
__________________________________________________
is there any code allow me to save and use taken picture from camera ?
↧