I have a webview. I want to get its drawing cache and and save it as a file in sdcard. I used following code:
WebView wv=new WebView(this);
wv.loadData(rawHtml,"text/html",null); // rawHtml is my html code
wv.buildDrawingCacheEnabled(true);
Bitmap bmp=wv.getDrawingCache();
Dont know why wv.getDrawingCache() always returns null.
I have tested my html code using:
setContentView(wv);
Its displaying properly.
Are you using this method immediately in the
onCreate()?If yes then you might have to consider overriding the below method,This method gets called as soon as your view gets drawn. And this is where you will get a view at all.