Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. @Override
  2. public void onPageFinished(WebView view, String url) {
  3. Picture picture = view.capturePicture();
  4. Toast.makeText(finplan.this, "picture height "+picture.getHeight()+ " url "+url, Toast.LENGTH_LONG).show();
  5.  
  6. mywebview.loadUrl("http://www.google.com");
  7. // this one works fine and picture.getHeight() is > 0
  8.  
  9. mywebview.loadUrl("file:///android_asset/test.html");
  10. // this one works, but the picture.getHeight() retrieved in onPageFinished is always 0
  11.  
  12. webView.setWebViewClient(new WebViewClient() {
  13.  
  14. @Override
  15. public void onPageFinished(WebView view, String url) {
  16. Picture picture = view.capturePicture();
  17. }
  18.  
  19. });
  20. webView.setPictureListener(new PictureListener() {
  21.  
  22. public void onNewPicture(WebView view, Picture picture) {
  23. if (picture != null) {
  24. Toast.makeText(MainActivity.this,
  25. "picture height " + picture.getHeight(),
  26. Toast.LENGTH_LONG).show();
  27. }
  28. }
  29. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement