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

Saving file to external storage in android

$
0
0

Application:mobile,Titanium SDK:3.3.0,platform:android,device:device(samsung and motorola) OSX:Mac OSX 10.9.3,Titanium studio:3.3.0.

Hi, I am taking a picture from camera and trying to save the file in external memory card But instead the file is saving in phone memory(sdcard0(local storage)) but not to sdcard1.Can any one suggest me please.

btn.addEventListener('click', function(e) {
        Titanium.Media.showCamera({
            success : function(event) {
                var image = event.media;
                if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {
                    var imageView = Ti.UI.createImageView({
                        image : event.media
                    });
                    win.add(imageView);
                    win.open();
                    var filename = win.title + "_" + win.comp + ".jpg";
                    Titanium.App.Properties.setString("filename", filename);
                    var f = Titanium.Filesystem.getFile(Titanium.Filesystem.externalStorageDirectory, filename);
                    f.write(image);
                    imageView.image = f.nativePath;
                    Ti.Media.Android.scanMediaFiles([f.nativePath], null, function(e) {
                    });
                    Ti.Media.hideCamera();
                }
            },
            cancel : function() {
                alert('You canceled the action.');
            },
            error : function(error) {
            },
            allowEditing : true,
            mediaTypes : [Ti.Media.MEDIA_TYPE_VIDEO, Ti.Media.MEDIA_TYPE_PHOTO],
        });
 
    });

Viewing all articles
Browse latest Browse all 8068

Trending Articles



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