• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Java and SQL

brentc

Newbie
I get no compiler error. The execution does not return from the following method...It crashes.

public boolean deleteOne(CustomerModel customerModel) {

SQLiteDatabase db = this.getWritableDatabase();
String queryString = "DELETE FROM CUSTOMER_TABLE" + " WHERE " + COLUMN_ID + "=" + customerModel.getId();
Cursor cursor = db.rawQuery(queryString, null);

if (cursor.moveToFirst()) {
return true;
} else {
return false;
}
}
 
If I implement a Toast like this....

Toast.maketext(MainActivity.this, "Hello", Toast.LENGTH_LONG).show();

It flags MainActivity.this with the error "is not an enclosing class". What should I use for that?
 
Back
Top Bottom