Ubah struktur tabel Anda menjadi ini
private static final String CREATE_USER_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_LOCATIONS + "("
+ UID + " TEXT PRIMARY KEY," + ADDRESS + " TEXT,"
+ LONGITUDE + " TEXT," + LATITUDE + " TEXT,
UNIQUE(" + LOGITUDE + "," + LATITUDE + ") ON CONFLICT REPLACE)";
Kemudian ketika Anda melakukan penyisipan gunakan metode di bawah ini
ContentValues insertValues = new ContentValues();
insertValues.put(LATITUDE, latitude);
insertValues.put(LOGITUDE, longitude);
db.insertWithOnConflict(TABLE_LOCATIONS, null, insertValues, SQLiteDatabase.CONFLICT_REPLACE);