Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.logo); File flle = null; try { OutputStream stream = null; flle = new File("/sdcard/renrenzhanggui/dazhanggui/logo.png"); if (!flle.exists()) { File newFile = flle.getParentFile(); newFile.mkdirs(); } stream = new FileOutputStream(flle); mBitmap.compress(CompressFormat.PNG, 90, stream); stream.flush(); stream.close(); } catch (Exception e) { e.printStackTrace(); }