Answer the question
In order to leave comments, you need to log in
Why is there an error in SqLiteDataBase?
public class ShowAllActivity extends AppCompatActivity {
ListView listViewShowAll;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show_all);
DataBaseHelper dataBaseHelper = new DataBaseHelper(this);
//ошибка из за нее, ее убираю, запускается, вставляю обратно, ошибка. В че проблема?
final SQLiteDatabase sqLiteDatabase = dataBaseHelper.getWritableDatabase();
}
}
class DataBaseHelper extends SQLiteOpenHelper {
DataBaseHelper(Context context) {
super(context, DataBase.DATABASE_NAME, null, DataBase.VERSION_BASE);
}
@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
sqLiteDatabase.execSQL("create table" + DataBase.DATABASE_TABLE_NAME +
"(id integer primary key autoincrement, " +
DataBase.DATABASE_STRING_NAME + " text, " +
DataBase.DATABASE_STRING_PHONE + " integer);");
}
@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
sqLiteDatabase.delete(DataBase.DATABASE_TABLE_NAME, null, null);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question