EDIT 2
EDIT
Override attachBaseContext method to update the context in activity
protected override void AttachBaseContext(Context @base)
{
base.AttachBaseContext(@base);
}
end edit
In Android API 25 Resources.UpdateConfiguration(Configuration, DisplayMetrics)
was deprecated and it's advised to use Context context = CreateConfigurationContext(Configuration);
instead.
Current implementation
public override Resources Resources
{
get
{
Resources res = base.Resources;
Configuration config = new Configuration();
config.SetToDefaults();
res.UpdateConfiguration(config, res.DisplayMetrics);
return res;
}
}
Referencing Android context.getResources.updateConfiguration() deprecated as a guide, tried the following:
public override Resources Resources
{
get
{
Configuration overrideConfiguration = base.Resources.Configuration;
overrideConfiguration.SetToDefaults();
Context context = CreateConfigurationContext(overrideConfiguration);
Resources res = context.Resources;
return res;
}
}
However this produces anomalous errors..
Android.Views.InflateException: Error inflating class
com.android.internal.widget.DialogTitle
How to correctly implement Context context = CreateConfigurationContext(Configuration)
?
Note 'Current implementation' works perfectly fine but as encouraged to not use deprecated code want to the replacement working