title: Button not saving state onResume
body: <p>I have just started Android development. I have a very simple project. I have a button and a textview. When I click the button, the text of the textView changes and button is disabled. This part is working fine. However I want the button to maintain its state (disabled state) if I press home on phone (Escape on keyboard) and go back to my app. But in my case, Button gets enabled every time I press home and get back to my app. Here is the code</p>
  
  <pre><code>package com.mypack.textmanipulation;
  
  import android.os.Bundle;
  import android.app.Activity;
  import android.view.Menu;
  import android.view.View;
  import android.widget.*;
  
  public class MainActivity extends Activity {
  
      private Button btnChangeText;
      private boolean check;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) 
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          btnChangeText = (Button)findViewById(R.id.btnChangeText);
          check = true;
  
          setButtonOnClickInterface();
  
      }
  
      @Override
      protected void onResume()
      {
          super.onResume();
          checkButtonIsEnabled();
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) 
      {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.activity_main, menu);
          return true;
      }
  
      private void setButtonOnClickInterface()
      {
  
          btnChangeText.setOnClickListener(new View.OnClickListener() 
          {
  
              @Override
              public void onClick(View v) 
              {
  
                      // TODO Auto-generated method stub
                      TextView txtView = (TextView)findViewById(R.id.textView1);
                      txtView.setText("Text Changed");
                      btnChangeText.setEnabled(false);
                      check = false;
              }
          });
  
      }
  
      private void checkButtonIsEnabled()
      {
          if (check)
          {
              btnChangeText.setEnabled(true);
  
          }
          else
          {
              btnChangeText.setEnabled(false);
          }
      }
  
  
  }
  </code></pre>
  
  <p>Suggestions are welcome.
  Thanks</p>