Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.image);
- String path = Environment.getExternalStorageDirectory().toString();
- OutputStream out = null;
- File file = new File(path, "imagename.jpg");
- try {
- out = new FileOutputStream(file);
- bm.compress(Bitmap.CompressFormat.PNG, 100, out);
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- try {
- if (out != null) {
- out.close();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement