title: Update a view from within a thread inside getView?
body: <p>I have an activity class that calls my custom adapter class which extends a base adapter. Inside my <code>getView</code> method I have a <code>button.setOnClickListener</code> within which there is a thread which downloads data. I want to set the button text to "downloading" when the user clicks, then after the download is finished, set the button text to "finished". How can I do this?</p>
  
  <pre><code>public class MyActivity extends Activity {
  //some code here
  private void setAdapter(ArrayList arrayList) {      
      listView.setAdapter(new UserAdapter(context,arrayList));        
  }
  }
  
  
  public class UserAdapter extends BaseAdapter {
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {     
       Holder holder = new Holder();      
       holder.button = (Button) view.findViewById(R.id.button);
       holder.button.setOnClickListener(new View.OnClickListener() {
       @Override
       public void onClick(View v) {
          new Thread(new Runnable() {
              @Override
              public void run() {
  
                  try{
                    //set button text to "downloading"
                    //establish an http connection and download data
                    //after download done, if successfull set button text to downloaded
                    //if download failed, set button text to failed.
                  } catch (Exception exception) {
                  }
              }
              }
          ).start();
        }
      });
  
      return view;
  }
  private class Holder {
      private Button button;
  }
  }
  </code></pre>