title: how can i implement two functions for one button onclick in android
body: <p>Hi am working in bluetooth in android, I have one button click which performs 2 activities.On first click it should perform return air and in 2nd click it should perform reading of setpoint. but in my code only one activity runs and it doesnt go to 2nd activity on 2nd click.In my code there is only one handler to perform this 2 activities. Should i have two handlers to perform this two activities? </p>
  
  <p>here is my code:
  This preforms first click:</p>
  
  <pre><code>private void returnair() { 
       //return air
       Log.d(TAG, "returnair()");
       setContentView(R.layout.dummy);
       load = (Button) findViewById(R.id.button1);
       load.setOnClickListener(new OnClickListener() {
           @Override
           public void onClick(View v) {
               String text = "16 16 36 01 10 00 00 00 00 00 00 00 00 00 00 00 00 88 47 ";
               sendMessage(text);
           }
       });
       mChatService = new blootoothchatservice(this, mHandler);
       mOutStringBuffer = new StringBuffer("");
  }
  </code></pre>
  
  <p>This performs 2nd click:</p>
  
  <pre><code>private void setpoint() {
          //reading setpoint
          Log.d(TAG, "setpoint()");
          setContentView(R.layout.dummy); 
          load = (Button) findViewById(R.id.button1);
          load.setOnClickListener(new OnClickListener() {
               @Override
               public void onClick(View v) {
                   String resp = "16 16 36 07 02 00 00 00 00 00 00 00 00 00 00 00 00 B7 93 ";
                   sendsetresponses(resp);
               }
          });
          mChatService = new blootoothchatservice(this, mHandler);
          mOutStringBuffer = new StringBuffer("");
  }
  </code></pre>