title: How to set on click listener for a custom button?
body: <p>I tried to setup my listener for my custom button class. However, it seems that my listener doesn't map to the View. Any idea to combine my button view and my custom button?</p>
  
  <p>I have my fragment with a custom button on a linear layout
  XML</p>
  
  <pre><code>&lt;LinearLayout&gt;
   ...
  &lt;Button&gt;
  ...
  &lt;/Button&gt;
  
  &lt;LinearLayout&gt;
  </code></pre>
  
  <p>I tried to setup a click listener for the button in the fragment at onActivityCreated method.</p>
  
  <pre><code>public class myFragment extend Fragment {
  
  @Override
  public void onActivityCreated (){
  
  Button myNewButton = new myButton();
  myNewButton = root.findViewByID.(R.id.button);
  myNewButton.setOnClickListener(new myButton());
  
  }
  
  }
  </code></pre>
  
  <p>My custom button class with a setonclicklistener method</p>
  
  <pre><code>public class myButton extend button implements View.onClicklistener {
  
  @Override
  public void setOnClickListener (OnClickListener listener){
  super.setonClickListener(listener);
  }
  
  @Override
  public void onClick(View view) {
  //action to do after on click
  }
  
  }
  </code></pre>