title: Having a user input the name of a button on Android
body: <p>Main Activity with button I want changed. It should import what the user put in the EditText from the other activity:</p>
  
  <pre><code>@Override
  protected void onResume() {
      super.onResume();
  
      class1.setText(this.getButtonText());
  }
  
  public String getButtonText()
  {
      SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
      String buttonText = prefs.getString("ButtonText", "Default Button Test");
      return buttonText;
  }
  </code></pre>
  
  <p>Activity with Edit text and a button to take the user back to the main page. I tried to use the shared preferences but am not sure how to do it?:</p>
  
  <pre><code> Button class1;
  
  
   @Override
   public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.editclass1); 
  
          SettingButtons();
          class1.setOnClickListener(this);
  
   }
  
  
  private void SettingButtons() {
      // TODO Auto-generated method stub
      class1 = (Button) findViewById(R.id.edittoclass1);
  }
  
  @Override
  public void onClick(View v) {
      // TODO Auto-generated method stub
      switch(v.getId()){
      case R.id.edittoclass1:
          startActivity(new Intent("com.clayton.calendar.TOCLASS"));
      break;
  
      }
  }
  
  
  
  
  
  
  protected void onPause() {
      // TODO Auto-generated method stub
      super.onPause();
      SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
      Editor editor = prefs.edit();
      editor.putString("ButtonText",  // This is not working
              ((TextView)findViewById(R.id.edittoclass1)).getText().toString());
      editor.commit();
      }
  </code></pre>
  
  <p>}</p>