Java tutorial
//package com.java2s; import android.content.res.Resources; import java.io.*; public class Main { public static InputStream getBmpInputStream(String filePath) { try { return new FileInputStream(new File(filePath)); } catch (Exception e) { e.printStackTrace(); return null; } } public static InputStream getBmpInputStream(Resources res, int resID) { if (res == null || resID == 0) { return null; } return res.openRawResource(resID); } }