@Manisch. Ik heb je voorbeeldcode aangepast. Gebruik cursor.getCount() op deze manier. Dank je
public ArrayList<String> getDefinations(String query, int column_index)
{
ArrayList<String> words = new ArrayList<String>();
MatrixCursor mcursor = null;
try
{
Stmt stmt = getDB2().prepare(query);
if (stmt.step())
{
//stmt.get_cursor().moveToFirst();
mcursor = stmt.get_cursor();
if(mcursor != null && mcursor.getCount() > 0)
{
try
{
mcursor.moveToFirst();
do
{
words.add(mcursor.getString(column_index));
}
while (mcursor.moveToNext());
}
catch (IndexOutOfBoundsException e)
{
if (MainActivity.logcat_status)
{
Log.e("Error", e + "");
}
}
}
}
}
catch (Exception e)
{
// TODO Auto-generated catch block
if (MainActivity.logcat_status)
{
Log.e("Error", e + "");
}
}
}