title: Delete multiple rows using IDs?
body: <p>How can I delete multiple rows by a list of IDs in Android SQLite database?</p>
  
  <p>I have defined a general delete method in this manner:</p>
  
  <pre><code>protected void deleteWhere(String whereClause, String[] whereArgs) {
      try {
          databaseHelper.getWritableDatabase().delete(
                  getTableName(), whereClause, whereArgs);
      } finally {
          databaseHelper.close();
      }
  }
  </code></pre>
  
  <p>And now I'm trying to call it with a list of IDs:</p>
  
  <pre><code>public void deleteAll(Iterable&lt;T&gt; entities) {
      Iterable&lt;Long&gt; ids = Iterables.transform(entities, getId);
  
      String whereClause = getIdColumn() + " IN (?)";
      String[] whereArgs = { TextUtils.join(",", ids) };
      deleteWhere(whereClause, whereArgs);
  }
  </code></pre>
  
  <p>If the ID list contains for example the values [1, 2, 42], then I assume the resulting SQL should be:</p>
  
  <pre><code>DELETE FROM tableName WHERE _id IN (1,2,42);
  </code></pre>
  
  <p>But this doesn't seem to work correctly. If the list contains only 1 ID, then it is correctly deleted. However, if I provide multiple values, than zero rows are affected. What am I doing wrong?</p>