title: Android - Disabled button still working
body: <p>I made a button, it calls refresh method:</p>
  
  <pre><code>... android:onClick="refresh"
  </code></pre>
  
  <p>In the begining of the method I set these:</p>
  
  <pre><code>btn.setEnabled(false);
  btn.setClickable(false);
  </code></pre>
  
  <p>And in the end I set enable and clickable true.
  My problem is that, after the first click while program is working and button is disabled I click on the button for example 3 times. When transaction is over it automatically starts again 3 times. So setEnabled(false) is not working.
  Can anybody tells me why?
  Thx.</p>
  
  <p>So there is only one button in my layout:</p>
  
  <pre><code>&lt;Button        
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="50dp"
    android:layout_gravity="center_horizontal"
    android:onClick="refresh"
    android:text="Refresh"
    android:textStyle="bold"
  
    android:background="@drawable/button"
     /&gt;
  </code></pre>
  
  <p>Here is the method:</p>
  
  <pre><code>public void refresh(View view){
      btn.setEnabled(false);
      btn.setClickable(false);
  
      final double currentLat = lat;
      final double currentLng = lng;
  
      if(isOnline == true) {
          String link = "http://maps.googleapis.com/maps/api/geocode/json?latlng="+currentLat+","+currentLng+"&amp;sensor=true&amp;language=hu";
          final GetLocation si = (GetLocation) new GetLocation(this, link).execute();
  
          Runnable runnable = new Runnable() {
              public void run() {
                  handler.post(new Runnable() {
                      public void run() {
                          Thread.currentThread();
  
                          try {
                              Thread.sleep(3000);
  
                              if(si.getAddress() != null) {
                                  address.setText(si.getAddress());
                              }                   
                              String date = DateFormat.getDateTimeInstance().format(new Date());
                              String data = date+": ["+currentLat+", "+currentLng+"] - "+si.getAddress()+"\n";
  
                              FileManagement f = new FileManagement(filename);
                              f.writeToFile(data);
  
                              btn.setEnabled(true);
                              btn.setClickable(true);
  
                          } catch (InterruptedException e) {
                              e.printStackTrace();
                          } catch (Exception e){
                              e.printStackTrace();
                          }
                      }
                  });
              }
          };
          new Thread(runnable).start();           
      }
  }
  </code></pre>