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

后端 未结 1 1517
北海茫月
北海茫月 2020-12-16 18:50

for example:

public final class R {

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

How can I

1条回答
  •  囚心锁ツ
    2020-12-16 19:45

    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 讨论(0)
提交回复
热议问题