JoxTraex probably has no idea about the Android platform or, as they say:
when someone says that this is impossible, there will always be someone who does not know this and will do it :)
so to the point:
Resources - , ResourcesImpl.
( - )
public Resources(AssetManager assets, DisplayMetrics metrics, Configuration config)
:
1)
2) ( ) ( , )
... " " - , LoadedApk, Activity .. , ? , ? : , : , , () / ...
- Android Context ContextImp, Context - , , :)
a) ( , ReourceImpl ( , )
public Resources(@Nullable ClassLoader classLoader)
)
setResImpl(ResourcesImpl)
:
Resources.getStringArray(**not existing in APK resource id here**);
, :)
addResourceById(int,Object)
:), :), :)
: - : " - ", ! - :)
:
getString:
public class MyContext extends Context {
....
@Override
public android.content.res.Resources getResources() {
android.content.res.Resources resources = super.getResources();
android.content.res.AssetManager assets = resources.getAssets();
android.util.DisplayMetrics displayMetrics = resources.getDisplayMetrics();
android.content.res.Configuration configuration = resources.getConfiguration();
return new android.content.res.Resources(assets, displayMetrics, configuration) {
@android.support.annotation.NonNull
@Override
public String getString(int id) throws android.content.res.Resources.NotFoundException {
return id == pl.ceph3us.base.common.R.string.my_sweet_google
? "fck_you_google";
: super.getString(id);
}
};
}
}