title: onClick fragments could not find method
body: <p>Im trying to create a ToDo list. I will admit Im still learning how to use fragments but I think my problem is a conflict with how fragments are designed. Right now I have a fragment for tasks. Where I will be adding in tasks and there is a List under. When I type in I click the add button and it should show up on the list. I also have an list_inner_view where there is a check box. </p>
  
  <p>Right now in the xml I have the android:onClick = "addTaskNow" method invoked. </p>
  
  <p>Here is my code. </p>
  
  <p>My fragment_tasks.xml </p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".FragmentTasks" &gt;
  
      &lt;EditText
          android:id="@+id/editText1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_alignParentTop="true"
          android:ems="10" &gt;
  
          &lt;requestFocus /&gt;
      &lt;/EditText&gt;
  
      &lt;Button
          android:id="@+id/button1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentRight="true"
          android:layout_alignParentTop="true"
          android:layout_marginRight="14dp"
          android:text="Add" 
          android:onClick="addTaskNow"/&gt;
  
      &lt;ListView
          android:id="@+id/list"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_below="@+id/button1" &gt;
      &lt;/ListView&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>My FragmentTasks.java</p>
  
  <pre><code>package com.example.navbar;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import android.content.Context;
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.util.Log;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ArrayAdapter;
  import android.widget.Button;
  import android.widget.CheckBox;
  import android.widget.EditText;
  import android.widget.ListAdapter;
  import android.widget.ListView;
  import android.widget.Toast;
  
  /**
   * A simple {@link Fragment} subclass.
   * 
   */
  public class FragmentTasks extends Fragment {
  
      public FragmentTasks() {
          // Required empty public constructor
      }
  
      protected TaskerDbHelper db;
      List&lt;Task&gt; list;
      MyAdapter adapt;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          View rootView = inflater.inflate(R.layout.fragment_tasks, container, false);
          //return inflater.inflate(R.layout.fragment_tasks, container, false);
          db = new TaskerDbHelper(getActivity());
          list = db.getAllTasks();
          adapt = new MyAdapter(getActivity(), R.layout.list_inner_view, list);
          ListView listTask = (ListView) rootView.findViewById(R.id.list);
          listTask.setAdapter((ListAdapter) adapt);
  
          Button b = (Button) rootView.findViewById(R.id.button1);
          return rootView;
      }
  
  
      public void addTaskNow(View v) {
          EditText t = (EditText) v.findViewById(R.id.editText1);
  
  
          String s = t.getText().toString();
          if (s.equalsIgnoreCase("")) {
              Toast.makeText(getActivity(), "enter the task description first!!",
                      Toast.LENGTH_LONG);
          } else {
              Task task = new Task(s, 0);
              db.addTask(task);
              Log.d("tasker", "data added");
              t.setText("");
              adapt.add(task);
              adapt.notifyDataSetChanged();
          }
  
      }
  
      private class MyAdapter extends ArrayAdapter&lt;Task&gt; {
  
          Context context;
          List&lt;Task&gt; taskList = new ArrayList&lt;Task&gt;();
          int layoutResourceId;
  
          public MyAdapter(Context context, int layoutResourceId,
                  List&lt;Task&gt; objects) {
              super(context, layoutResourceId, objects);
              this.layoutResourceId = layoutResourceId;
              this.taskList = objects;
              this.context = context;
          }
  
          /**
           * This method will DEFINe what the view inside the list view will
           * finally look like Here we are going to code that the checkbox state
           * is the status of task and check box text is the task name
           */
          @Override
          public View getView(int position, View convertView, ViewGroup parent) {
              CheckBox chk = null;
              if (convertView == null) {
                  LayoutInflater inflater = (LayoutInflater) context
                          .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                  convertView = inflater.inflate(R.layout.list_inner_view,
                          parent, false);
                  chk = (CheckBox) convertView.findViewById(R.id.checkBox1);
                  convertView.setTag(chk);
  
                  chk.setOnClickListener(new View.OnClickListener() {
  
                      @Override
                      public void onClick(View v) {
                          CheckBox cb = (CheckBox) v;
                          Task changeTask = (Task) cb.getTag();
                          changeTask.setStatus(cb.isChecked() == true ? 1 : 0);
                          db.updateTask(changeTask);
                          /*Toast.makeText(
                                  getApplicationContext(),
                                  "Clicked on Checkbox: " + cb.getText() + " is "
                                          + cb.isChecked(), Toast.LENGTH_LONG)
                                  .show();
                      } */
  
                  }});
              } else {
                  chk = (CheckBox) convertView.getTag();
              }
              Task current = taskList.get(position);
              chk.setText(current.getTaskName());
              chk.setChecked(current.getStatus() == 1 ? true : false);
              chk.setTag(current);
              Log.d("listener", String.valueOf(current.getId()));
              return convertView;
  
  
      }
  
  
  
  
  }}
  </code></pre>