I changed the locale
of my application programmatically, like following:
Resources res = context.getResources();
DisplayMetri
You can simply detach and attach fragment as below
Fragment currentFragment = getFragmentManager().findFragmentByTag("FRAGMENT");
FragmentTransaction fragTransaction = getFragmentManager().beginTransaction();
fragTransaction.detach(currentFragment);
fragTransaction.attach(currentFragment);
fragTransaction.commit();
This will refresh the view and locale will change
I finally found the solution to it! Just run your view update code in the UI thread
Example -
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
user_arrayList.add(name);
adapter.notifyDataSetChanged();
tv_total_users.setText("Total Users : "+user_arrayList.size());
}
});
Finally found this solution after trying for almost 4-5 hours!
You could create a listener, which will be called when the locale changes. This will then remove the Fragment, and re add the Fragment. Your new locale should then be picked up.