title: how to save button Click Event in Android Shared Preferences
body: <p>I have two Activities.Now i want to know how to save the button Click-event , like when i pressed the button  want to save boolean value true in Shared Preferenaes , when  not pressed the button the boolean value is false in Shared Preferenaes every time whenever go to that second page.Can someone help me how to do this trick.Thanks in advanced.This is my code of Button Click .</p>
  
  <pre><code>  imgBtn_LogOut.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) 
  {
   SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
                      SharedPreferences.Editor editor = sharedPreferences.edit();
                      editor.putBoolean("strUserName", true);
                      editor.commit();
  
                      File database = getApplicationContext().getDatabasePath(dbhelper.DATABASE_NAME);
  
                      if (!database.exists())
                      {
                          Log.e("Database", "Not Found");
                      }
                      else
                      {
                          Log.e("Database", "Found");
                          getApplicationContext().deleteDatabase(dbhelper.DATABASE_NAME);
                          Log.e("Database", " Deleted Completeley !!!");
  
                          removeImagesFromFolder();
  
                          Intent i = new Intent(Filter_Screen.this, Login_Screen.class);
                          startActivity(i);
                          finish();
                      }
                  }
              });
  </code></pre>