Java tutorial
//package com.java2s; /** * Copyright 2014 sailaway(https://github.com/sailaway) * * Licensed under theGNU GENERAL PUBLIC LICENSE Version 3 (the "License"); * Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> * Everyone is permitted to copy and distribute verbatim copies * of this license document, but changing it is not allowed. * */ import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import android.graphics.Bitmap; public class Main { public static boolean saveBitmap(Bitmap bitmap, String filepath) { File f = new File(filepath); FileOutputStream out = null; try { out = new FileOutputStream(f); bitmap.compress(Bitmap.CompressFormat.PNG, 90, out); } catch (FileNotFoundException e) { return false; } finally { if (out != null) { try { out.close(); } catch (IOException e) { } } } return true; } }