Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 2013 Sprint 09 Core, 2013 Sprint 09, Release 3.2.0
-
Fix Version/s: 2014 Sprint 05, 2014 Sprint 05 Core, Release 6.2.0
-
Component/s: Android
-
Labels:
-
Environment:
Motorola Droid HD Razr Maxx running Android 4.1.1
-
Story Points:13
-
Epic Link:
-
Sprint:2017 Sprint 14 SDK
Description
Call Ti.Media.showCamera and the camera opens up fine, takes the picture fine, then click ok, and the app crashes before reaching the success function.
The picture does manage to get saved into the photo gallery.
Sample code. Paste this into a new Android application.
var win = Titanium.UI.createWindow();
|
var imageView = Ti.UI.createImageView({height: Ti.UI.FILL, width: Ti.UI.Fill});
|
win.add(imageView);
|
Titanium.Media.showCamera({
|
|
success:function(event)
|
{
|
Ti.API.info('#### Camera Success');
|
var cropRect = event.cropRect;
|
var image = event.media;
|
Ti.API.info(image.length);
|
var filename = Titanium.Filesystem.tempDirectory + "/"+ 'camera_photo' + new Date().getTime() + ".png";
|
Ti.API.info(filename);
|
var f = Titanium.Filesystem.getFile(filename);
|
Ti.API.info(f.nativePath);
|
if (f.exists()) {
|
Ti.API.info('The file exist , trying to delete it before using it :' + f.deleteFile());
|
f = Titanium.Filesystem.getFile(filename);
|
}
|
f.write(image);
|
alert('Camera Success! The file size is '+f.size+' bytes.\n Now trying to assign it to an image on the screen (this may fail for hi res images)')
|
imageView.image = f.nativePath;
|
},
|
cancel:function()
|
|
{
|
Ti.API.info('#### Camera Cancel');
|
},
|
error:function(error)
|
{
|
// create alert
|
Ti.API.info('#### Camera Error');
|
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
|
});
|
win.open();
|
Attachments
Issue Links
- is duplicated by
-
TIMOB-4899 Android: Camera crashes Sony Ericsson Xperia Arc Android 2.3.2, 2.3.3 with all branches
-
- Closed
-
-
TIMOB-9363 Android: Application forced close after taking picture from camera or selecting picture from gallery on first load.
-
- Closed
-
-
TIMOB-11887 Android: Media - Application crashes on Motorola RAZR i
-
- Closed
-
- relates to
-
TIMOB-24528 Android: Fails to load images that exceed GPU max texture size
-
- Open
-
-
AC-1984 Android: Titanium.Media.showCamera crashes for pictures of 6MP or more
- Closed
-
TIMOB-14533 Android: Picture capture returns last photo in gallery, not the one just captured
-
- Closed
-
-
TIMOB-16524 Android: Alert dialog appears behind window
-
- Closed
-
-
TIMOB-11959 Android: ShowCamera crashes application on "Sony Ericsson Xperia u"
-
- Closed
-
- links to