android - How to convert a AChartEngine chart to bitmap -


i want convert line graph made achartengine lib bitmap.how should do?i didn't found on net can help. tobitmap() method suitable?if yes how use it?

update: used method :

 public static bitmap loadbitmapfromview(view v) {   v.setdrawingcacheenabled(true); v.layout( 0,0,800,600); v.setdrawingcachequality(view.drawing_cache_quality_high); v.builddrawingcache(); v.getdrawingcache();  bitmap bmp = bitmap.createbitmap(800,600, bitmap.config.argb_8888); v.setdrawingcacheenabled(false); return bmp; } 

and saved result in png file got empty file !

tobitmap() seems return null.

try this:

            //get graphical view              graphicalview v = chartfactory.getlinechartview(context,                              builddataset(titles, x, values), renderer);              //enable cache              v.setdrawingcacheenabled(true);               //set layout manually 800*600              v.layout(0, 0, 800, 600);               //set quality high              v.setdrawingcachequality(view.drawing_cache_quality_high);               //build cache, bitmap , close cache              v.builddrawingcache(true);              bitmap b = bitmap.createbitmap(v.getdrawingcache());              v.setdrawingcacheenabled(false);  

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -