code: private static int getIdentifier(Context context, String type, String key) {
      return context.getResources().getIdentifier(key, type, context.getPackageName());
    }
docs: Get the identifier for the resource with a given type and key.