search() doesn't work but rawquery cursor with same query works
<p>I have created a custom DBAdapter and have created several functions including search() which returns a cursor based on a rawquery statement</p>

<pre><code>    public Cursor search(String param) {
    Cursor cursor = mDb.rawQuery("Select distinct DiagLookup._id, diagnosis, diagcode, favourite From DiagLookup Left Outer Join DiagSynonyms On DiagLookup._id = DiagSynonyms.dxid Where diagnosis = ? OR syn = ? OR diagcode = ? order by diagnosis asc", new String[]{"%"+param+"%","%"+param+"%","%"+param+"%"});
    return cursor;
}
</code></pre>

<p>When I call search() in my Search ListActivity it doesn't work but when I insert the following statements within Search it works</p>

<pre><code>    public void doMySearch(String query_results) {
    SQLiteDatabase db = (new DatabaseHelper(this)).getWritableDatabase();

    //dbh = new DxDbAdapter(this);
    //dbh.open();

    String[] columns = new String[] {"diagnosis", "diagcode"};
    int[] to = new int[] {R.id.diagnosis, R.id.code};

    //Cursor cursor = dbh.search(query_results);
    Cursor cursor = db.rawQuery("Select DiagLookup._id, diagnosis, diagcode, favourite From DiagLookup Left Outer Join DiagSynonyms On DiagLookup._id = DiagSynonyms.dxid Where diagnosis Like ? OR syn Like ? OR diagcode Like ? order by diagnosis asc", new String[]{"%"+query_results.trim()+"%","%"+query_results.trim()+"%","%"+query_results.trim()+"%"});
    startManagingCursor(cursor);    
    adapter = new DxSimpleCursorAdapter(this,R.layout.list_detail,cursor,columns,to);
    setListAdapter(adapter);
}
</code></pre>

<p>You can see that I have commented out my original way of populating the cursor with my search() function that doesn't work... any ideas what I am doing wrong?</p>

<p>The error I get when running <code>Cursor cursor = dbh.search(query_results);</code> code is</p>

<pre><code>couldn't save which view has focus because the focused view com.android.internal.policy.impl.PhoneWindow$DecorView@4053d398 has no id.
</code></pre>

<p>When I run <code>Cursor cursor = db.rawQuery("Select DiagLookup._id, diagnosis, diagcode, favourite From DiagLookup Left Outer Join DiagSynonyms On DiagLookup._id = DiagSynonyms.dxid Where diagnosis Like ? OR syn Like ? OR diagcode Like ? order by diagnosis asc", new String[]{"%"+query_results.trim()+"%","%"+query_results.trim()+"%","%"+query_results.trim()+"%"});</code> it works and returns a populated listview.</p>
