title: Android call a method on fragment with onClick error
body: <p>i am populating a set of <code>custom_rows</code> into my <code>listview</code> from <code>baseadapter</code>.
  And i set the listview in my fragment.
  I am trying to set <code>android:onClick="openComment</code> to the button which is in my <code>custom_row.xml</code> but the i get the below error </p>
  
  <pre><code>java.lang.IllegalStateException: Could not find method openComment(View) in a parent or ancestor Context for android:onClick attribute defined on view class android.support.v7.widget.AppCompatImageView with id 'open'
  </code></pre>
  
  <p>In my Fragment i have the method openComment. How do i call the the method from the button click.
  This is Fragment shows how i call the method.</p>
  
  <pre><code>public class Home extends android.support.v4.app.Fragment implements View.OnClickListener {
  ....
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      myview = inflater.inflate(R.layout.home, container,false);
      listView = (ListView) myview.findViewById(R.id.activity_main);
  return myview;
  }
  ....
  ....
  public void openComment(View v)
  {
    //getting the position of clicked row
    final int position = listView.getPositionForView((View) v.getParent());
    System.out,print("button clicked");
  }
  </code></pre>
  
  <p>my <code>custom_row.xml</code> looks like this. it has a textview and a button</p>
  
  <pre><code>&lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"&gt;
  
          &lt;Button
              android:id="@+id/open"
              android:onClick="openComment"
              android:layout_width="45dp"
              android:layout_height="45dp"/&gt;
          &lt;TextView
              android:id="@+id/name"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Below is my ListView  <code>activity_main.xml</code></p>
  
  <pre><code>&lt;LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"&gt;
  
  &lt;ListView
      android:id="@+id/custom_list"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"&gt;
  &lt;/ListView&gt;
  </code></pre>
  
  <p></p>