例如:
公共final类环R {
公共静态final类原料{
公共静态最终诠释尤里= 0x7f040000;
}
}
我怎样才能获得其名称的资源? 如果不使用R.raw.yuri =(INT)
解决方案 getResources()则getIdentifier(尤里,原始,getPackageName())。
我发现这是非常缓慢的。我剥离出来我的整个项目做一些分析后,并使用 INT []
代替。
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)
解决方案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.