Is it possible to refresh the view of a Fragment

后端 未结 3 900
滥情空心
滥情空心 2020-12-31 01:12

I changed the locale of my application programmatically, like following:

Resources res = context.getResources();

 DisplayMetri         


        
3条回答
  •  时光取名叫无心
    2020-12-31 01:48

    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

提交回复
热议问题