Java tutorial
//package com.java2s; //License from project: Apache License import java.io.File; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class Main { public static final String DATABASE_NAME = "dqxx.db"; public static final String TABLE_NAME = "dqxx"; public static boolean isCityExist(Context context, String city) { File file = new File(context.getFilesDir(), DATABASE_NAME); SQLiteDatabase db = context.openOrCreateDatabase(file.getAbsolutePath(), Context.MODE_PRIVATE, null); Cursor cursor = db.rawQuery("select count(1) from " + TABLE_NAME + " where DQXX02=?", new String[] { city }); cursor.moveToNext(); return cursor.getInt(0) > 0; } }