Here you can find the source of tourNameExists(SQLiteDatabase db, String tourName)
public static boolean tourNameExists(SQLiteDatabase db, String tourName)
//package com.java2s; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; public class Main { protected final static String TOUR_TABLE_NAME = "Tour"; protected final static String TOUR_NAME = "name"; public static boolean tourNameExists(SQLiteDatabase db, String tourName) { Cursor cursor = db.query(TOUR_TABLE_NAME, new String[] { TOUR_NAME }, TOUR_NAME + "=?", new String[] { tourName }, null, null, null); cursor.moveToFirst();//from w w w .j a v a 2s . co m if (cursor.getCount() == 0) return false; else return true; } }