title: Variable in setOnClickListener cannot be resolved
body: <p>I've looked everywhere, but I can't find what I'm looking for.</p>
  
  <p>I'm trying to make a stopwatch app for android using a <code>Chronometer</code> inside of a <code>Fragment</code>, but I'm getting errors on the <code>setOnClickListener</code> for some buttons.</p>
  
  <p>It's the variables inside of parentheses "()" fx. (<code>mStartListener</code>), I get the error <code>mStartListener cannot be resolved to a variable</code>.</p>
  
  <p>please help me, I really wanna get into android developing. Thank you </p>
  
  <p>Here's the code</p>
  
  <pre><code>b = (Button) getView().findViewById(R.id.start);
  b.setOnClickListener(mStartListener); //--- error
  b = (Button) getView().findViewById(R.id.stop);
  b.setOnClickListener(mStopListener); //--- error
  b = (Button) getView().findViewById(R.id.reset);
  b.setOnClickListener(mResetListener); //--- error
  </code></pre>
  
  <p>Full Code:</p>
  
  <pre><code>import android.app.Fragment;
  import android.os.Bundle;
  import android.os.SystemClock;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.Chronometer;
  
  public class StopWatchFragment extends Fragment {
  
      Chronometer mChronometer;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
      }
  
      @Override
      public void onActivityCreated(Bundle savedInstanceState) {
          super.onActivityCreated(savedInstanceState);
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
          View view = inflater.inflate(R.layout.stopwatch, container, false);
  
          Button b;
          mChronometer = (Chronometer) getView().findViewById(R.id.chronometer);
          // Watch for button clicks.
          b = (Button) getView().findViewById(R.id.start);
          b.setOnClickListener(mStartListener); //--- error
          b = (Button) getView().findViewById(R.id.stop);
          b.setOnClickListener(mStopListener); //--- error
          b = (Button) getView().findViewById(R.id.reset);
          b.setOnClickListener(mResetListener); //--- error
  
  
          return view;
  
  
      View.OnClickListener mStartListener = new OnClickListener() {
          public void onClick(View v) {
              mChronometer.start();
          }
      };
      View.OnClickListener mStopListener = new OnClickListener() {
          public void onClick(View v) {
              mChronometer.stop();
          }
      };
      View.OnClickListener mResetListener = new OnClickListener() {
          public void onClick(View v) {
              mChronometer.setBase(SystemClock.elapsedRealtime());
      }
      };
  }
  }
  </code></pre>