Code example for FileOutputStream

Methods: close, flush

0
		Bitmap b = v.getDrawingCache();
		File myPath = new File("/sdcard/Cura/Snapshots/" + title + ".png");
		// construct the screenshot's filename 
		FileOutputStream fos = null;
		try { 
			fos = new FileOutputStream(myPath);
			b.compress(Bitmap.CompressFormat.PNG, 80, fos);
			fos.flush();
			fos.close();
			MediaStore.Images.Media.insertImage(cr, b, "Screen", "screen");
			// take the screenshot and store it. 
		} catch (Exception ex) {
			// TODO Auto-generated catch block 
			ex.printStackTrace();
		} 
	} 
}