2

AndroidでチタンのshowCameraを起動してフォトギャラリー機能を開くと、問題に直面する人はいますか?アプリをクラッシュさせ、アプリを自動的に再起動します。多くのフォーラム、特に JIRA appcelator と titanium フォーラムを検索しましたが、ほとんどのケースは未解決です。私はフォーラムで多くの方法を試しましたが、それでも同じです。これはチタンの虫ですか?

4

2 に答える 2

0

カメラを開くためにこのコードを使用していますが、正しく動作します。

    Titanium.Media.showCamera({

        success:function(event)
        {
            //getting media
            var image = event.media;
            im=image;
            //checking if it is photo
            if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO)
            {
                imgpath= image.nativePath;
                $.userphoto.image=imgpath;//$.userphoto is an imageview
            }
        },
        cancel:function()
        {
            //do somehting 
        },
        error:function(error)
        {
            //error happened,
            var a = Titanium.UI.createAlertDialog({title:'Camera'});
            //set message
            if (error.code == Titanium.Media.NO_CAMERA)
            {
                alert('No Cam');
            }
            else
            {
                alert('error');
            }

        },
        mediaTypes:[Ti.Media.MEDIA_TYPE_VIDEO,Ti.Media.MEDIA_TYPE_PHOTO]
    });
}

これは、フォトギャラリーを開くために使用するコードです(これも正常に動作します):

Titanium.Media.openPhotoGallery({
        success:function(event)
        {

            //check if  photo
            if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO)
            {   
                im=resize(event.media); //just a function to resize the photo
                imgpath= event.media.nativePath;

                $.userphoto.image=imgpath;
            }  
        },
        cancel:function()
        {
            //user cancelled 
        }
    });

ちなみに今はTitanium SDK 3.4.1 GAを使っていますが、以前は3.1.3GAでも動いていました

于 2015-02-07T20:22:39.860 に答える