Java tutorial
//package com.java2s; import java.io.InputStream; import android.content.Context; public class Main { private static InputStream openFileId(Context context, int fileId) { InputStream stream = context.getResources().openRawResource(fileId); if (stream == null) { throw new IllegalStateException("Could not find object config file with id " + fileId); } return stream; } }