开发者

How can I get Resources by name (string) and not by integer

开发者 https://www.devze.com 2022-12-30 00:47 出处:网络
for 开发者_如何学Goexample: public final class R { public static final class raw { public static final int yuri=0x7f040000;

for 开发者_如何学Goexample:

public final class R {

    public static final class raw {
        public static final int yuri=0x7f040000;
    }
}

How can I get the resource by its name? Without using R.raw.yuri = (int)


getResources().getIdentifier( "yuri" , "raw" , getPackageName() );

I found this to be extremely slow. I stripped it out of my whole project after doing some profiling and used int[] instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消