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

Android: webview toImage() problem

$
0
0

In my app I use this code to make a screenshot of an entire webview:

j = 5 //number of times necessary to see the entire webview
for(var i=1, x; i<j; i++){
    var screenShot = myWebView.toImage().media;
    myWebView.evalJS('window.scrollTo(0,'+(winHeight*i)+')');
    var imageName = "image" + i + ".png"
    var exportImage = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,imageName);
    exportFile.write(screenShot)
)};
This works well on iOS, but does not work on Android. On Android fact, always saves the top of the webview. I also tried to scroll the webview to the bottom, so that the visible part was the final one, but as soon as I make a toImage(), always saves the top, even if in the device is visible only the final one.

Viewing all articles
Browse latest Browse all 8068

Trending Articles