Android. TypedArray use to hold drawable

    <array name="main_fragment_button_drawables">
        <item>@drawable/button_green</item>
        <item>@drawable/button_orange</item>
        <item>@drawable/button_pink</item>
   </array>

buttons.xml

    TypedArray main_fragment_button_drawables = context.getResources()
                .obtainTypedArray(R.array.main_fragment_button_drawables);
    .....
    view.setBackgroundResource(main_fragment_button_drawables.getResourceId(position, -1));

MyAdapter.java