The data access code in my Android app raises an exception.
Here is the code that causes the exception:
String getPost = \"SELECT * FROM \" + TABLE_POST
You havent moved cursor index to first .. Try like this below
String getPost = "SELECT * FROM " + TABLE_POST + ";";
Cursor result = getReadableDatabase().rawQuery(getPost, null);
List posts = new ArrayList();{
Log.d("count", result.getCount() + " post rows");
if (result .moveToFirst()) {
do {
Post post = new Post();
post.setPostId(result.getInt(0));
posts.add(post);
....
} while (result .moveToNext());
}
result .close();