Resources res = this.getResources();
BitmapDrawable d = (BitmapDrawable) res.getDrawable(R.drawable.ic_launcher);
Bitmap img = d.getBitmap();
String fn = "image_test.png";
String path = this.getFilesDir() + File.separator + fn;
try{
OutputStream os = new FileOutputStream(path);
img.compress(CompressFormat.PNG, 100, os);
os.close();
}catch(Exception e){
Log.e("TAG", "", e);
}
Android保存一张drawable下的图片资源保存到绝对路径下
最新推荐文章于 2022-08-11 18:15:09 发布