Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15810] Android: Media: ImageView is not setting the captured image

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionDuplicate
Resolution Date2013-11-25T22:58:25.000+0000
Affected Version/sRelease 3.2.0
Fix Version/sn/a
ComponentsAndroid
Labelsqe-3.2.0
ReporterParas Mishra
AssigneeIngo Muschenetz
Created2013-11-25T11:19:29.000+0000
Updated2017-03-21T23:09:35.000+0000

Description

Android: Media: ImageView is not setting the captured image. Image is successfully getting saved to gallery. This is regression, it works fine on SDK: 3.1.3.GA Steps to reproduce: 1. Run the App below.


    //
	//TIMOB-8518 ImageView does not handle width or height set to Ti.UI.FILL correctly
	//

var win = Titanium.UI.createWindow({backgroundColor:'white'});
win.open();

Titanium.Media.showCamera({
 
    success:function(event)
    {
        var cropRect = event.cropRect;
        var image = event.media;
 		Ti.API.info("Height : "+ image.height);
 		Ti.API.info("Width : "+ image.width);
        Ti.API.debug('Our type was: '+event.mediaType);
        
        if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO)
        {
            var imageView = Ti.UI.createImageView({
                width:Ti.UI.FILL,
                height:Ti.UI.FILL,
                image:KS_nav_ui.png
            });
            Ti.API.info("ImageView Object : "+ imageView);
            win.add(imageView);
        }
        else
        {
            alert("got the wrong type back ="+event.mediaType);
        }
    },
    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('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_VIDEO,Ti.Media.MEDIA_TYPE_PHOTO]
});

2. Take the picture and save it. Expected: You should see the image in the next screen (a newly created image view) Actual: A blank ImageView is displayed.

Comments

  1. Lokesh Choudhary 2013-11-25

    The code above has the image property of the imageView set to "image:KS_nav_ui.png" rather than "event.media" which is wrong. This is a duplicate of TIMOB-8518. I am able to repro the issue in TIMOB-8518 when the width & height of the imageView is set to "Ti.UI.FILL" and reopening it. There is a similar test in "KS/phone/camera/camerabasic" in which the width & height of the imageView is set to "win.height" & "win.width".It works without any issues & I can see the captured image in the imageView. Environment: Appcel Studio : 3.2.0.201311221207 Ti SDK : 3.2.0.v20131122172908 Mac OSX : 10.8.5 Alloy : 1.3.0-alpha6 CLI - 3.2.0-alpha Nexus 5 - android 4.4 Device: Samsung Galaxy S4 running android 4.2.2
  2. Lokesh Choudhary 2013-11-25

  3. Lee Morris 2017-03-21

    Closing ticket as duplicate with reference to the above comments.

JSON Source