Java tutorial
//package com.java2s; //License from project: Apache License import java.util.LinkedHashMap; import java.util.Map; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class Main { public static Map<String, Integer> getArea(SQLiteDatabase db, String tableName, int dqx_dqxx01) { Map<String, Integer> areaMap = new LinkedHashMap<String, Integer>(); Cursor cursor = db.query(tableName, new String[] { "DQXX02", "DQXX01" }, "DQX_DQXX01=?", new String[] { "" + dqx_dqxx01 }, null, null, "DQXX01 ASC"); if (cursor != null) { while (cursor.moveToNext()) { areaMap.put(cursor.getString(0), cursor.getInt(1)); } } if (cursor != null && !cursor.isClosed()) { cursor.close(); } return areaMap; } }