Is there a way to recreate the "parent" class from a static class?

165 Views Asked by At

I am working on an app where I am trying to change the language inside the app with a preference screen and using a preferenceList. I am able to listen to the choices, but I can't seem to recreate the "parent" class. Everywhere I changed the language by setting language choice in onCreate(...). But how would you update the language in the activity you are currently in? I listen to changes in language choice in a static class like this :

public class PrefActivity extends PreferenceActivity {

  @Override
  public onCreate(Bundle savedInstanceState) {
    //Code
  }
  
  public static class PreferenceFrag extends PreferenceFragment {
    //onCreate method

    .... SharedPreferences.OnSharedPreferenceChangeListener() {
       @Override
       public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) {
         //Reads the changes and sets new locale
         //How would you make the changes come instant to the R.xml.Preference
    }
  }
}
1

There are 1 best solutions below

0
On

Think I found the answers by using this as follow:

getActivity().recreate();