2012-05-11 4 views
0

이미지 갤러리를 열 때 때로는 응용 프로그램이 충돌하고 때로는 그렇지 않습니다. Java 예외는 표시하지만 의미있는 메시지는 표시되지 않습니다.Appcelerator - Android 이미지 갤러리 galley

누구나 아이디어가 있습니까? 나 또한 의도를 사용했지만 작동하지 않습니다.

Thnxs! 여기

내 코드 샘플 : 내가 프로젝트에서 전환으로

Here a sample of my code: 
function openGallery() { 
var popoverView; 
var arrowDirection; 

if(Titanium.Platform.osname == 'ipad') { 
    // photogallery displays in a popover on the ipad and we 
    // want to make it relative to our image with a left arrow 
    arrowDirection = Ti.UI.iPad.POPOVER_ARROW_DIRECTION_LEFT; 
    popoverView = imageView; 
} 
var image = undefined; 
Titanium.Media.openPhotoGallery({ 

    success : function(event) { 
     var cropRect = event.cropRect; 
     image = event.media; 

     // set image view 
     Ti.API.debug('Our type was: ' + event.mediaType); 
     if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) { 
      addAttachment(image); 
     } else { 
      // is this necessary? 
     } 
    }, 
    cancel : function() { 

    }, 
    error : function(error) { 
    }, 
    allowEditing : true, 
    saveToPhotoGallery : true, 
    popoverView : popoverView, 
    arrowDirection : arrowDirection, 
    mediaTypes : [Ti.Media.MEDIA_TYPE_VIDEO, Ti.Media.MEDIA_TYPE_PHOTO] 
    }); 
} 
+0

일부 코드를 표시하십시오. –

+0

죄송합니다. 방금 게시했습니다. – Jefiozie

답변

0

이 질문은 위의 의견에 해결 된 적이 없다.

0
var win = Titanium.UI.createWindow({ 
    title:"Accessing the photo album", 
    backgroundColor:"#FFFFFF", 
    exitOnClose:true 
}); 

var button = Titanium.UI.createButton({ 
    title:"Open the photo gallery", 
    width:180, 
    height:48, 
    bottom: 12, 
    zIndex:2 
}); 

button.addEventListener("click", function(e){ 
    //Open the photo gallery 
    Titanium.Media.openPhotoGallery({ 
     //function to call upon successful load of the gallery 
     success:function(e){ 
      //e.media represents the photo or video 
      var imageView = Titanium.UI.createImageView({ 
       image:e.media, 
       width:320, 
       height:480, 
       top:12, 
       zIndex:1 
      }); 

      win.add(imageView); 
     }, 
     error:function(e){ 
      alert("There was an error"); 
     }, 
     cancel:function(e){ 
      alert("The photo gallery was cancelled"); 
     }, 
     //Allow editing of media before success 
     allowEditing:true, 
     //Media types to allow 
     mediaTypes:[Ti.Media.MEDIA_TYPE_PHOTO] 
     //The other is Titanium.Media.MEDIA_TYPE_VIDEO 
    }); 
}); 

win.add(button); 

win.open();