Java tutorial
//package com.java2s; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; public class Main { public static Bitmap getBitmapByFile(File file) { FileInputStream fis = null; Bitmap bitmap = null; try { fis = new FileInputStream(file); bitmap = BitmapFactory.decodeStream(fis); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (OutOfMemoryError e) { e.printStackTrace(); } finally { try { fis.close(); } catch (Exception e) { } } return bitmap; } }