Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
We are developing a dynamic graph using android with java. We want to save the complete graph which is getting plotted in jpeg format. While trying to save the graph on the screen which is visible is getting saved.

Please help me.....

Below is the code for the same.


view.setDrawingCacheEnabled(true);
Bitmap bmp = Bitmap.createBitmap(view.getDrawingCache());
view.setDrawingCacheEnabled(false);
FileOutputStream fos = new FileOutputStream("Test.JPEG", true);
bmp.compress(CompressFormat.JPEG, 100, fos);
fos.close();

Thank you in advance.....
Posted
Updated 5-Dec-12 1:19am
v2

1 solution

You might need to build the cache, try

Java
view.setDrawingCacheEnabled(true);
view.buildDrawingCache(); //<<<<--- try this
Bitmap bmp = Bitmap.createBitmap(view.getDrawingCache());
...
...


/Darren
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900