Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-14852

Android: Image View does not render all the images captured using device Camera

    Details

      Description

      Trying to render images on imageView captured using Camera API, But imageView done not render images after 2 or 3 if images are not resized using imageAsResized method.

      Steps to reproduce:

      1: Use the attached app.js or below sample code.
      2: Run it using new sample project.
      3: Test the application on device (Preferred is Samsung S3 or S2 with android 4.1.2).
      4: If images are not resized then after 2 or 3 images, image view won't display them.

      *sample code*

      var mainWin = Ti.UI.createWindow({
      	backgroundColor:"#fff"
      });
      var button = Ti.UI.createButton({
      	title : "Take",
      	width : "60dp",
      	height : "45dp",
      	top : "2dp",
      	left : "2dp"
      });
       
      var button1 = Ti.UI.createButton({
      	title : "Add",
      	width : "60dp",
      	height : "45dp",
      	top : "2dp",
      	right : "2dp"
      });
       
      var scrollView = Ti.UI.createScrollView({
      	layout:"horizontal",
      	top:"50dp"
      })
       
      var successCallBack = function(e) {
      		if (e.mediaType != Ti.Media.MEDIA_TYPE_PHOTO) {
      			Ti.App.fireEvent('hide_indicator');
      			return false;
      		}
      		
      		var image = e.media;//.imageAsResized(120,120); //400 - 17 images added and if only e.media 2 images..
      		var filename = (new Date().getTime()) + ".jpg";
      		Ti.API.info("JAVA : "+ filename + " " + e.media.getLength());
      		
      		var newImageView = Ti.UI.createImageView({
      			image : image,
      			width : "60dp",
      			height : "60dp",
      			left : "5dp",
      			top: "5dp"
      		});
      		scrollView.add(newImageView);
      		var bgImage = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory, filename);
      		bgImage.write(image);
      		//utils.resizeKeepAspectRatioNewWidth(bgImage.getNativePath(), image.width, image.height, Config.imageMaxWidth);
      	};
       
       
      button.addEventListener("click", function(e) {
      	Ti.Media.showCamera({
      		success : successCallBack,
      		mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO]
      	});
      });
       
      button1.addEventListener("click", function(e) {
      	Ti.Media.openPhotoGallery({
      		success : successCallBack,
      		mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO]
      	});
      });
       
      mainWin.add(scrollView);
      mainWin.add(button);
      mainWin.add(button1);
      mainWin.open();
      
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sunila Sunila
                Reporter:
                anigam Ashish Nigam
              • Watchers:
                0 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-17183
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration