Java tutorial
//package com.java2s; import android.content.Context; import android.content.res.Resources; public class Main { private static Context context; public static int getResRawID(String resName) { Resources res = context.getResources(); return res.getIdentifier(resName, "raw", context.getPackageName()); } }