title: Android disable button on successful doinbackground call
body: <p>The following code gives Fatal Exception Async Task #2 on the line <code>v1.setEnabled(false)</code>.</p>
  
  <p>It means to disable button on successful call. The <code>v.setEnabled(false);</code> before background task works fine. Please help :(                                                            </p>
  
  <pre><code>public void onClick(View v) {
      Intent intent = new Intent(DISPLAY_MESSAGE_ACTION);
      //this one would work
      //v.setEnabled(false);
  
      final View v1=v;
      mRegisterTask1 = new AsyncTask&lt;Void, Void, Void&gt;() {
  
      @Override
      protected Void doInBackground(Void... params) {
          boolean success = 
              ServerUtilities.receipt (((String)v1.getTag()).substring(3),"acknowledged");
  
          if (success) {
              //this one causes Async Task exception
              v1.setEnabled(false);
          } 
          else {
          }
          return null;
      }
  
      @Override
      protected void onPostExecute(Void result) {
          mRegisterTask1 = null;
      }
  </code></pre>