title: Show-hide toggle button for Layout in Android
body: <p>I was wondering why a button I made to show/hide my layouts only works once, i.e, initially my layouts are GONE, then when I click a button they're VISIBLE, but later when I click the same button, their View is not being set back to GONE. </p>
  
  <pre><code>    /**
   * Method to show/hide buttons, on button click.
   * @param v
   */
  public void hideOrDisplayOptionIconsButton(View v)
  {
      // Hide layouts if VISIBLE
      if(mMapViewsButtonsLinearLayout.getVisibility() == View.VISIBLE
         &amp;&amp; mLocationButtonsLinearLayout.getVisibility() == View.VISIBLE)
      {
          mMapViewsButtonsLinearLayout.setVisibility(View.GONE);
          mLocationButtonsLinearLayout.setVisibility(View.GONE);
      }
      // Show layouts if they're not VISIBLE
      else
      {
          mMapViewsButtonsLinearLayout.setVisibility(View.VISIBLE);
          mLocationButtonsLinearLayout.setVisibility(View.VISIBLE);
      }
  }
  </code></pre>