sql >> Base de Datos >  >> RDS >> SQLite

SQLite3.Exception:la imagen del disco de la base de datos tiene un formato incorrecto

@Manish. He editado su código de muestra. Utilice cursor.getCount() como este. Gracias

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 + "");
       }
     }
}