Android examples for Database:SQL Query
Execute select statement via SQLiteDatabase and return a cursor
//package com.java2s; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class Main { public static Cursor getContacts(SQLiteDatabase db) { // Select All Query String selectQuery = "SELECT _id, name, number FROM contacts ORDER BY name ASC"; Cursor cursor = db.rawQuery(selectQuery, null); return cursor; }//from w w w.ja v a2s.co m }