Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Android: TiMedia: (main) OnResult called: -1

$
0
0

I'm getting the following messages in my log when selecting a photo from a gallery:

  • [ERROR] : TiMedia: (main) [19607,322454] OnResult called: -1
  • [INFO] : I/dalvikvm-heap: Grow heap (frag case) to 53.367MB for 31961104-byte allocation
  • [INFO] : I/dalvikvm-heap: Grow heap (frag case) to 53.439MB for 31961104-byte allocation
  • [INFO] : I/dalvikvm-heap: Grow heap (frag case) to 55.328MB for 1997584-byte allocation
  • [INFO] : Choreographer: Skipped 127 frames! The application may be doing too much work on its main thread.

Code being ran in global.js:

function selectPhoto() {
    Titanium.Media.openPhotoGallery({
        success : function(event) {
            if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {
                var submitPhotoWindow = Alloy.createController('submitPhoto', {
                    image : event.media
                }).getView();
 
                var dir = Titanium.Filesystem.getApplicationDataDirectory();
                var file = Titanium.Filesystem.getFile(dir, 'attachimage.jpg');
                if (file.exists()) {
                    file.deleteFile();
                }
 
                var resizedImage = resizeImage(event.media);
                var compressedImage = ImageFactory.compress(resizedImage, 0.5);
                file.write(compressedImage);
 
                submitPhotoWindow.prepare();
                submitPhotoWindow.open();
            }
        }
    });
}
Should I be doing something differently? I don't get the issue when running Titanium.Media.showCamera(). Thanks for any tips.

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>