title: Changing buttons' texts on another activities causes error (Unfortunately appname has Stopped)
body: <p>I have an android project on eclipse , so I making localization for it (for both Arabic and English users). </p>
  
  <p>The problem simply is that  when I press a button (English or Arabic button) to  change buttons' texts on that activities other than the current activity (MainActivity) I get the error:-</p>
  
  <p>Unfortunately , appname has stopped.</p>
  
  <p>But when I run the application without changing these Buttons' texts (Only changing  MainActivity buttons' texts from language to language) there is no errors and the application works fine. </p>
  
  <p>This the <strong>MainActivity.java</strong> (Observe that I put  ZAD_ISLAMI_button as an instance of ZAD_ISLAMI_BUTTON which itself a button from another activity).</p>
  
  <pre><code>public class MainActivity extends Activity
  {
          private Button English,Arabic,life_pls,Top_Team ,exit,MobiLink_button,
                  Amro_Khaled ,Short_SMS_button ,ZAD_ISLAMI_button;
          private Locale myLocale;
          public void changeLang(String lang)
          {
                  if (lang.equalsIgnoreCase(""))
                          return;
                  myLocale = new Locale(lang);
                  saveLocale(lang);
                  Locale.setDefault(myLocale);
                  android.content.res.Configuration config = new android.content.res.Configuration();
                  config.locale = myLocale;
                  getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
                  updateTexts();
          }
          public void saveLocale(String lang)
          {
                  String langPref = "Language";
                  SharedPreferences prefs = getSharedPreferences("CommonPrefs", Activity.MODE_PRIVATE);
                  SharedPreferences.Editor editor = prefs.edit();
                  editor.putString(langPref, lang);
                  editor.commit();
          }
  
          public void loadLocale()
          {
                  String langPref = "Language";
                  SharedPreferences prefs = getSharedPreferences("CommonPrefs", Activity.MODE_PRIVATE);
                  String language = prefs.getString(langPref, "");
                  changeLang(language);
          }
          private void updateTexts()
          {
  
                  English.setText(R.string.English);
                  Arabic.setText(R.string.Arabnas);
                  life_pls.setText(R.string.Life_Plus_Button);
                  Top_Team.setText(R.string.Top_Team_Button);
                  Zad_button.setText(R.string.Zad_Button);
                  Amro_Khaled.setText(R.string.Amro_Khaled_Button);
                  Short_SMS_button.setText(R.string.Short_SMS_Button);
                  //The problem here in ZAD_ISLAMI_button.
                  ZAD_ISLAMI_button.setText(R.string.ZAD_ISLAMI_BUTTON);
          }
          @Override
          protected void onCreate(Bundle savedInstanceState) {
                  super.onCreate(savedInstanceState);
                  setContentView(R.layout.activity_main);
                  this.English= (Button)findViewById(R.id.English);
                  this.Arabic = (Button)findViewById(R.id.Arabics);
                  this.life_pls = (Button)findViewById(R.id.Life_Plus_Button);
                  this.Top_Team =(Button)findViewById(R.id.Top_Team_Button);
                  this.Amro_Khaled =(Button)findViewById(R.id.Amro_Khaled_Button);
                  this.ZAD_ISLAMI_button=(Button)findViewById(R.id.ZAD_ISLAMI_BUTTON);
                  Button  english = (Button) findViewById(R.id.English);
                  english.setOnClickListener(new View.OnClickListener() {
                          public void onClick(View v) {
                                  String lang = "en";
                                  switch (v.getId()) {
                                          case R.id.English:
                                                  lang = "en";
                                                  break;
                                          case R.id.Arabics:
                                                  lang = "ar";
                                                  break;
                                          default:
                                                  break;
                                  }
                                  changeLang(lang);
                          }
                  });
                  Button  Arabic= (Button) findViewById(R.id.Arabics);
                  Arabic.setOnClickListener(new View.OnClickListener() {
                          public void onClick(View v) {
                                  String lang = "ar";
                                  switch (v.getId()) {
                                          case R.id.English:
                                                  lang = "en";
                                                  break;
                                          case R.id.Arabics:
                                                  lang = "ar";
                                                  break;
                                          default:
                                                  break;
                                  }
                                  changeLang(lang);
                          }
                  });
          }
  }
  </code></pre>
  
  <p><strong>activity_main.xml file</strong></p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
  
      tools:context=".MainActivity" &gt;
  
      &lt;Button
          android:id="@+id/MobiLink_Button"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_alignParentRight="true"
          android:layout_below="@+id/Short_SMS_Button "
          android:text="@string/MobiLink_Button" /&gt;
  
      &lt;Button
          android:id="@+id/Short_SMS_Button "
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_alignParentRight="true"
          android:layout_below="@+id/Amro_Khaled_Button"
          android:text="@string/Short_SMS_Button" /&gt;
  
      &lt;Button
          android:id="@+id/Zad_Button"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_above="@+id/Amro_Khaled_Button"
          android:layout_alignParentLeft="true"
          android:layout_alignParentRight="true"
          android:text="@string/Zad_Button" /&gt;
  
      &lt;Button
          android:id="@+id/Top_Team_Button"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_above="@+id/Zad_Button"
          android:layout_alignParentLeft="true"
          android:layout_alignParentRight="true"
          android:text="@string/Top_Team_Button" /&gt;
  
      &lt;Button
          android:id="@+id/Life_Plus_Button"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_above="@+id/Top_Team_Button"
          android:layout_alignParentLeft="true"
          android:layout_alignParentRight="true"
          android:text="@string/Life_Plus_Button" /&gt;
  
      &lt;TextView
          android:id="@+id/textView1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentTop="true"
          android:layout_centerHorizontal="true"
          android:text="@string/application_title"
          android:textAppearance="?android:attr/textAppearanceLarge" /&gt;
  
      &lt;Button
          android:id="@+id/English"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:layout_alignParentLeft="true"
          android:text="بالانجليزي" /&gt;
  
      &lt;Button
          android:id="@+id/exit"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:layout_toRightOf="@+id/English"
          android:text="@string/exit" /&gt;
  
      &lt;Button
          android:id="@+id/Arabics"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:layout_alignParentRight="true"
          android:text="بالعربية" /&gt;
  
      &lt;Button
          android:id="@+id/Amro_Khaled_Button"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_alignParentRight="true"
          android:layout_centerVertical="true"
          android:text="@string/Amro_Khaled_Button" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>