Java tutorial
//package com.java2s; import android.content.res.TypedArray; import android.support.annotation.AnyRes; import android.support.annotation.StyleableRes; public class Main { @AnyRes public static int getResourceId(TypedArray a, @StyleableRes int index, @StyleableRes int fallbackIndex, @AnyRes int defaultValue) { return a.getResourceId(index, a.getResourceId(fallbackIndex, defaultValue)); } }