Android: Howto get a resource id of an android resource

前端 未结 1 345
孤独总比滥情好
孤独总比滥情好 2020-12-15 22:27

I want to get a resource id of an android resource that I have saved in /res/raw folder.

The use -

1) I am passing the name of the resource to the class an

相关标签:
1条回答
  • 2020-12-15 23:12

    You should be able to get the resource id with getIdentifier() :

    int id = this.getResources().getIdentifier("xyz", "raw", this.getPackageName());
    
    0 讨论(0)
提交回复
热议问题