title: IN clause and placeholders
body: <p>I'm attempting to do the following SQL query within Android:</p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>    String names = "'name1', 'name2";   // in the code this is dynamically generated
  
      String query = "SELECT * FROM table WHERE name IN (?)";
      Cursor cursor = mDb.rawQuery(query, new String[]{names});
  </code></pre>
  
  <p>However, Android does not replace the question mark with the correct values.  I could do the following, however, this does not protect against SQL injection:</p>
  
  <pre class="lang-java prettyprint-override"><code>    String query = "SELECT * FROM table WHERE name IN (" + names + ")";
      Cursor cursor = mDb.rawQuery(query, null);
  </code></pre>
  
  <p>How can I get around this issue and be able to use the IN clause?</p>