Processing cursors is a very common task that developers do when creating android apps. Here's some sample loops for processing cursors. Pay attention to log files to make sure that there are no null pointer exceptions when developing your cursor processing.
Cursor cur = dB.rawQuery("SELECT firstname, salary FROM demos " +
"where salary>100,000 LIMIT 10", null);
if (cur != null ) {
if (cur.moveToFirst()) {
do {
String firstName = cur.getString(cur.getColumnIndex("firstname"));
int salary = cur.getInt(cur.getColumnIndex("salary"));
results.add("" + firstName + ",salary: " + salary);
} while (cur.moveToNext());
}
}
cur.close();
I have read your code which is very complex to understand but it is good stuff done by you thanks for sharing this information.
ReplyDeleteAndroid App Development
I liked this post very much as it has helped me a lot in my google android app development and is quite interesting as well. Thank you for sharing this information with us.
ReplyDelete