Это реализация getText()
в Context.java
. Класс абстрактный, но у него есть реализация этого метода.
public final CharSequence getText(int resId) {
return getResources().getText(resId);
}
Реализация Resources.getText()
:
public CharSequence getText(int id) throws NotFoundException {
CharSequence res = mAssets.getResourceText(id);
if (res != null) {
return res;
}
throw new NotFoundException("String resource ID #0x"
+ Integer.toHexString(id));
}
Реализация AssetManager.getResourceText()
:
final CharSequence getResourceText(int ident) {
synchronized (this) {
TypedValue tmpValue = mValue;
int block = loadResourceValue(ident, (short) 0, tmpValue, true);
if (block >= 0) {
if (tmpValue.type == TypedValue.TYPE_STRING) {
return mStringBlocks[block].get(tmpValue.data);
}
return tmpValue.coerceToString();
}
}
return null;
}
Upd: Как упоминается @zapl loadResourceValue()
является нативным и может быть найдено в android_util_AssetManager.cpp
.