Java tutorial
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class Main { public static final String TABLE_NAME = "dqxx"; public static ArrayList<ContentValues> getArea(SQLiteDatabase db, int dqx_dqxx01) { ArrayList<ContentValues> list = new ArrayList<ContentValues>(); ContentValues values = null; Cursor cursor = db.query(TABLE_NAME, new String[] { "DQXX01", "DQXX02", "DQXX05" }, "DQX_DQXX01=?", new String[] { "" + dqx_dqxx01 }, null, null, "DQXX01 ASC"); if (cursor != null) { while (cursor.moveToNext()) { values = new ContentValues(); values.put("area_id", cursor.getInt(0)); values.put("area", cursor.getString(1)); values.put("full_area", cursor.getString(2)); list.add(values); } } if (cursor != null && !cursor.isClosed()) { cursor.close(); } return list; } }