title: Passing an object to AsyncTask method cannot be applied to given type
body: <p>I am trying to use AsyncTask to add objects to my SQLite database. I have 4classes: MainActivity, DBHelper, ToDo_Item, and an AsyncTask inner class named DatabaseAsyncAdd</p>
  
  <pre><code>class ToDo_Item {
  
  //MEMBER ATTRIBUTES
  private int _id;
  private String description;
  private int is_done;
  
  public ToDo_Item() {
  }
  
  public ToDo_Item(String desc, int done) {
      description = desc;
      is_done = done;
  }
  
  public int getId() {
      return _id;
  }
  public void setId(int id) {
      _id = id;
  }
  
  public String getDescription () {
      return description;
  }
  public void setDescription (String desc) {
      description = desc;
  }
  
  public int getIs_done() {
      return is_done;
  }
  
  public void setIs_done(int done) {
      is_done = done;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Here is the method from DBHelper I am trying to use:</p>
  
  <pre><code>public void addToDoItem(ToDo_Item task) {
      SQLiteDatabase db = this.getWritableDatabase();
      ContentValues values = new ContentValues();
  
      //ADD KEY-VALUE PAIR INFORMATION FOR THE TASK DESCRIPTION
      values.put(KEY_DESCRIPTION, task.getDescription()); // task name
  
      //ADD KEY-VALUE PAIR INFORMATION FOR
      //IS_DONE VALUE: 0- NOT DONE, 1 - IS DONE
      values.put(KEY_IS_DONE, task.getIs_done());
  
      // INSERT THE ROW IN THE TABLE
      db.insert(DATABASE_TABLE, null, values);
      taskCount++;
  
      // CLOSE THE DATABASE CONNECTION
      db.close();
  }
  </code></pre>
  
  <p>and my main including AsyncTask</p>
  
  <pre><code>public class MainActivity extends Activity {
  
  protected DBHelper mDBHelper;
  private List&lt;ToDo_Item&gt; list;
  private MyAdapter adapt;
  private EditText myTask;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      // TASK 1: LAUNCH THE LAYOUT REPRESENTING THE MAIN ACTIVITY
      setContentView(R.layout.activity_main);
  
      // TASK 2: ESTABLISH REFERENCES TO THE UI
      //      ELEMENTS LOCATED ON THE LAYOUT
      myTask = (EditText) findViewById(R.id.editText1);
  
      // TASK 3: SET UP THE DATABASE
      mDBHelper = new DBHelper(this);
      /*
      list = mDBHelper.getAllTasks();
      adapt = new MyAdapter(this, R.layout.todo_item, list);
      ListView listTask = (ListView) findViewById(R.id.listView1);
      listTask.setAdapter(adapt);
      */
  }
  
  @Override
  protected void onResume(){
      super.onResume();
      list = mDBHelper.getAllTasks();
      adapt = new MyAdapter(this, R.layout.todo_item, list);
      ListView listTask = (ListView) findViewById(R.id.listView1);
      listTask.setAdapter(adapt);
  }
  
  //BUTTON CLICK EVENT FOR ADDING A TODO TASK
  public void addTaskNow(View view) {
      String s = myTask.getText().toString();
      if (s.isEmpty()) {
          Toast.makeText(getApplicationContext(), "A TODO task must be entered.", Toast.LENGTH_SHORT).show();
      } else {
  
          //BUILD A NEW TASK ITEM AND ADD IT TO THE DATABASE
          ToDo_Item task = new ToDo_Item(s, 0);
          mDBHelper.addToDoItem(task);
          new DatabaseAsyncAdd().execute(task);
  
          // CLEAR OUT THE TASK EDITVIEW
          myTask.setText("");
  
          // ADD THE TASK AND SET A NOTIFICATION OF CHANGES
          adapt.add(task);
          adapt.notifyDataSetChanged();
      }
  }
  
  //BUTTON CLICK EVENT FOR DELETING ALL TODO TASKS
  public void clearTasks(View view) {
      mDBHelper.clearAll(list);
      adapt.notifyDataSetChanged();
  }
  
  private class DatabaseAsyncAdd extends AsyncTask&lt;ToDo_Item, String, Void&gt; {
      int progress_status;
  
      @Override
      protected void onPreExecute() {
          // UPDATE THE UI IMMEDIATELY BEFORE BACKGROUND WORK IS PERFORMED
          super.onPreExecute();
          Toast.makeText(MainActivity.this, "Accessing Database",
                  Toast.LENGTH_SHORT).show();
  
      }
  
      @Override
      protected Void doInBackground(ToDo_Item... task) {
          String s = myTask.getText().toString();
          mDBHelper.addToDoItem(task);
          return null;
      }
  
  
      @Override
      protected void onPostExecute(Void result) {
          super.onPostExecute(result);
  
      }
  }
  
  //******************* ADAPTER ******************************
  private class MyAdapter extends ArrayAdapter&lt;ToDo_Item&gt; {
      Context context;
      List&lt;ToDo_Item&gt; taskList = new ArrayList&lt;ToDo_Item&gt;();
  
      public MyAdapter(Context c, int rId, List&lt;ToDo_Item&gt; objects) {
          super(c, rId, objects);
          taskList = objects;
          context = c;
      }
  
  //******************* TODO TASK ITEM VIEW ******************************
      /**
       * THIS METHOD DEFINES THE TODO ITEM THAT WILL BE PLACED
       * INSIDE THE LIST VIEW.
       *
       * THE CHECKBOX STATE IS THE IS_DONE STATUS OF THE TODO TASK
       * AND THE CHECKBOX TEXT IS THE TODO_ITEM TASK DESCRIPTION.
       */
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          CheckBox isDoneChBx = null;
          if (convertView == null) {
              LayoutInflater inflater = (LayoutInflater) context
                      .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              convertView = inflater.inflate(R.layout.todo_item, parent, false);
              isDoneChBx = (CheckBox) convertView.findViewById(R.id.chkStatus);
              convertView.setTag(isDoneChBx);
              isDoneChBx.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View view) {
                      CheckBox cb = (CheckBox) view;
                      ToDo_Item changeTask = (ToDo_Item) cb.getTag();
                      changeTask.setIs_done(cb.isChecked() == true ? 1 : 0);
                      mDBHelper.updateTask(changeTask);
                  }
              });
          } else {
              isDoneChBx = (CheckBox) convertView.getTag();
          }
          ToDo_Item current = taskList.get(position);
          isDoneChBx.setText(current.getDescription());
          isDoneChBx.setChecked(current.getIs_done() == 1 ? true : false);
          isDoneChBx.setTag(current);
          return convertView;
      }
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu.
      getMenuInflater().inflate(R.menu.menu_main, menu);
      return true;
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      // Handle action bar item clicks here. The action bar will
      // automatically handle clicks on the Home/Up button, so long
      // as you specify a parent activity in AndroidManifest.xml.
      int id = item.getItemId();
  
      //noinspection SimplifiableIfStatement
      if (id == R.id.action_settings) {
          return true;
      }
  
      return super.onOptionsItemSelected(item);
  }
  }
  </code></pre>
  
  <p>I am trying to create a ToDo_Item on the addtasknow method which is a button click method. That object is then passed to the execute method in DatabaseASyncAdd. mDBHelper.addToDoItem(task) is saying "ToDo_Item cannot be applied to ToDo_Item[]" although it works outside of the AsyncTask class. Am I not calling execute correctly?</p>