1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| LinearLayout saisie=new LinearLayout(getApplicationContext());
saisie=(LinearLayout)findViewById(R.id.zone_saisie);
saisie.setDrawingCacheEnabled(true);
Bitmap b = saisie.getDrawingCache();
FileOutputStream fos = null;
try {
fos = new FileOutputStream(Environment.getExternalStorageDirectory().getAbsoluteFile()+"/"+code+".png");
b.compress(Bitmap.CompressFormat.PNG, 95, fos);
Log.d("TAG",Environment.getExternalStorageDirectory().getAbsoluteFile()+"/Tableau_de_bord/"+code+".png");
}
catch (Exception e) {
Log.d("TAG",e.getMessage());
}
finally {
if (fos != null) {
try {
fos.flush();
fos.close();
} catch (IOException e) {
Log.d("TAG",e.getMessage());
}
}
} |
Partager