我有一个从db读取数据的功能。但这总是返回错误..我对android了解不多..寻求帮助
10-03 11:33:05.870: E/AndroidRuntime(1321): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.projects.myworldsafe/com.projects.myworldsafe.DeailedView}: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
.
String getItemDetailsWp(String id){
System.out.print(id);
SQLiteDatabase db = this.getReadableDatabase();
String[] params=new String[]{id};
String selectQuery = "SELECT Content FROM " + TABLE_ITEMS +" WHERE "+ITEM_ID+"=?";
Cursor c=db.rawQuery(selectQuery,params);
c.moveToFirst();
int index= c.getCount();
int indexd= c.getColumnIndex(ITEM_CONTENT);
System.out.print("Count query"+indexd);
return c.getString(index);
}