Dynamic Resource Loading Android

后端 未结 3 1765
长发绾君心
长发绾君心 2020-11-29 01:47

I\'m trying to find a way to open resources whose name is determined at runtime only.

More specifically, I want to have a XML that references a bunch of other XML fi

3条回答
  •  孤独总比滥情好
    2020-11-29 02:03

    There is another method:

    int drawableId = R.drawable.class.getField("file1").getInt(null);
    

    According to this blog it's 5x times faster than using getIdentifier.

提交回复
热议问题