Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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> getProvince(SQLiteDatabase db, String tableName) {
        Map<String, Integer> provinceMap = new LinkedHashMap<String, Integer>();
        Cursor cursor = db.query(tableName, new String[] { "DQX_DQXX01", "DQXX02" }, "DQXX03=?",
                new String[] { "1" }, null, null, "DQX_DQXX01 ASC");
        if (cursor != null) {
            while (cursor.moveToNext()) {
                provinceMap.put(cursor.getString(1), cursor.getInt(0));
            }
        }
        if (cursor != null && !cursor.isClosed()) {
            cursor.close();
        }
        return provinceMap;
    }
}