I'm trying to create button that would make screenshot and save it to gallery in my android app, but, I just cannot find any working code and always get some error. Does anyone know about working appcelerator code for getting screenshots? Right now my code is looking like this which is not working.
$.btnScreen.addEventListener("click",function(e){
Ti.Media.takeScreenshot(function(){
var image = imgView.toBlob();
f =Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,"blog_image.jpg");
f.write(image);
});
This code gives me an error: imgView is not defined. I'm also getting error that gallery cannot be created when I tried different code.