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

11,510
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.

Share:
11,510
Alex Kapustian
Author by

Alex Kapustian

Updated on June 09, 2022

Comments

  • Alex Kapustian
    Alex Kapustian almost 2 years

    for example:

    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)