title: Creating a custom OnClickListener
body: <p>I have an ArrayList of Buttons where my OCL needs to know which index I has been pressed.
  The plan is something like this:</p>
  
  <pre><code>MyOnClickListener onClickListener = new MyOnClickListener() {
  
          @Override
          public void onClick(View v) {
  
              Intent returnIntent = new Intent();
              returnIntent.putExtra("deleteAtIndex",idx);
              setResult(RESULT_OK, returnIntent);
              finish();
  
          }
      };
      for (int i =0;i&lt;buttonList.size();i++) {
          buttonList.get(i).setText("Remove");
          buttonList.get(i).setOnClickListener(onClickListener);
      }
  </code></pre>
  
  <p>How does my implementation of the OCL need to look like ?</p>
  
  <p>Currently I have this:</p>
  
  <pre><code>public class MyOnClickListener implements OnClickListener{
  
  int index;
  
  public MyOnClickListener(int index)
  {
      this.index = index;
  }
  
  @Override
  public void onClick(View arg0) {
  
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>However, I am unsure of what I need to do within the constructor of my OCL, aswell as the overriden <code>onClick</code> function.</p>