Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/455.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Ti.Media.takeScreenshot-只有创建视图层次结构的原始线程才能接触其视图_Javascript_Android_Titanium Mobile - Fatal编程技术网

Javascript Ti.Media.takeScreenshot-只有创建视图层次结构的原始线程才能接触其视图

Javascript Ti.Media.takeScreenshot-只有创建视图层次结构的原始线程才能接触其视图,javascript,android,titanium-mobile,Javascript,Android,Titanium Mobile,我在尝试拍摄屏幕截图时出现此错误。我可以拍摄屏幕,但即使同时出现此错误 这是我的密码 sharebutton.addEventListener('click', function(e) { Ti.Media.takeScreenshot(function(event) { //scrollView.toImage(); var filenameforscreenshot = "screenshot" + new Date().getDate()+".jpg

我在尝试拍摄屏幕截图时出现此错误。我可以拍摄屏幕,但即使同时出现此错误

这是我的密码

sharebutton.addEventListener('click', function(e) {
    Ti.Media.takeScreenshot(function(event) {
        //scrollView.toImage();
        var filenameforscreenshot = "screenshot" + new Date().getDate()+".jpg";
        Ti.API.info('cam filename-' + filenameforscreenshot);
        var scrnImage = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, filenameforscreenshot);
        scrnImage.write(event.media);
        Ti.App.Properties.setString("screenshotcapture", scrnImage.nativePath);
    });
    var createnewWindow = require('ui/sharestay');
    new createnewWindow(my_id, '').open();
    win.close();
});
控制台中的错误

[ERROR] :  TiExceptionHandler: (main) [0,5081] - Message: Uncaught Error:  Only the original thread that created a view hierarchy can touch its views.
[ERROR] :  TiExceptionHandler: (main) [0,5081] - Source: ).open(),o.close()}),u.addEventListener("click",function(){Ti.Media.takeScreen
[ERROR] :  V8Exception: Exception occurred at ui/stay_listexpand.js:1: Uncaught Error: Only the original thread that created a view hierarchy can touch its views.

Plz help我被困在这里一天多了…

如果需要更多信息,请发表评论。。。