I used Google chart api to generate the chart using webview in android. Now开发者_如何学Go my next requirement is to save that image into some local storage and to send the image via email and mms.please help me in doing that.
thanks nishant
WebView w = new WebView(this);
//Loads the url
w.loadUrl("http://www.yahoo.com";);
//After loading completely, take its picture
Picture picture = w.capturePicture();
//Create a new canvas
Canvas mCanvas = new Canvas();
//Draw the Picture into the Canvas
picture.draw(mCanvas);
//Create a Bitmap
Bitmap sreenshot = Bitmap.createBitmap(picture.getWidth(),
picture.getHeight(),Config.ARGB_8888);
//copy the content fron Canvas to Bitmap
mCanvas.drawBitmap(mBitmapScreenshot, 0, 0, null);
//Save the Bitmap to local filesystem
if(sreenshot != null) {
ByteArrayOutputStream mByteArrayOpStream = new
ByteArrayOutputStream();
screenshot.compress(Bitmap.CompressFormat.JPEG, 90,
mByteArrayOpStream);
try {
fos = openFileOutput("yahoo.jpg",
MODE_WORLD_WRITEABLE);
fos.write(mByteArrayOpStream.toByteArray());
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
And for sending the images thro email u can go thru this question
and for MMS
精彩评论