2016-03-27 41 views
0

我有一個設置活動,在此活動中有一個按鈕。這個按鈕改變語言。但是,當我嘗試這個時,只更改設置活動的語言。我如何更改所有活動的語言?我如何控制另一個班級的語言變化?更改所有活動語言

這是改變值的代碼;

   // TODO Auto-generated method stub 
      Locale locale = new Locale("en"); //local en 
      Locale.setDefault(locale); 
      Configuration config = new Configuration(); 
      config.locale = locale; 
      getBaseContext().getResources().updateConfiguration(config, 
        getBaseContext().getResources().getDisplayMetrics()); 
      finish(); 
      startActivity(getIntent()); 
      Toast.makeText(getApplicationContext(), R.string.dil_degistir, Toast.LENGTH_LONG).show(); 

回答

0

我認爲你正在做的就OK了,但你需要「刷新」第一個活動看到的變化..

也許你可以使用startActivityForResult啓動設置活動,而當響應到達第一次活動,你可以刷新這個屏幕