How to Change the Text of a button using EditText on Android
<p>I am trying to use an EditText one one Activity to change the text of a button on another. I know I have to go through the SharedPreferences, and although this is where I am stuck.</p>

<p>Activity with the Button:</p>

<pre><code>protected void onResume() {
    super.onResume();

    class1.setText(this.getButtonText());
}

public String getButtonText()
{
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    String buttonText = prefs.getString("ButtonText", "Default button text"); // I am not sure how to get the button text here. This is what someone was trying to have me do?
    return buttonText;
}
</code></pre>

<p>This is my Activity that has the EditText and the button to go back to the activity with the button:</p>

<pre><code>public class EditClass1 extends Activity implements OnClickListener{

    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;      
        }
    }

    @Override
    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>
