Removed an unnecessary column, changed after this DATEBASE_VERSSION and such an error:
FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example/com.MainActivity}: android.database.sqlite.SQLiteException: no such table: ContactFruit (code 1): , while compiling: SELECT * FROM ContactFruit writes what is wrong with the method:
public List<Fruit> getAllFruits() { List<Fruit> fruitList = new ArrayList<Fruit>(); String selectQuery = "SELECT * FROM " + TABLE_CONTACT_FRUIT; SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); if (cursor.moveToFirst()) { do { Fruit fruit = new Fruit(); fruit.setId(Integer.parseInt(cursor.getString(0))); fruit.setName(cursor.getString(1)); fruit.setPrice(Integer.parseInt(cursor.getString(2))); fruitList.add(fruit); } while (cursor.moveToNext()); } return fruitList; }