android specified locale for the whole application -
what tried follows
final locale locale = new locale("en", "us"); locale.setdefault(locale); final configuration config = new configuration(); config.locale = locale; getbasecontext().getresources().updateconfiguration(config, getbasecontext().getresources().getdisplaymetrics()); i wants set particular locale whole application , doing @ application class level, above given lines seems not working when changing locale language specification setting date-picker not have effect of application class specified locale , taking locale setting language specification.
i'm not sure if works setting locale on application level, since haven't tried myself.
a workaround (that know works) create super activity e.g. myactivity extends activity. set code
final locale locale = new locale("en", "us"); locale.setdefault(locale); final configuration config = new configuration(); config.locale = locale; getbasecontext().getresources().updateconfiguration(config, getbasecontext().getresources().getdisplaymetrics()); in oncreate() method of myactivity, , allow activities extend myactivity instead of activity.
android
No comments:
Post a Comment