Вы пытаетесь добавить запись в таблицу, которая не существует, из-за того, что вы не создаете правильную таблицу в вашем onCreate
методе вашего DatabaseHelper
класса (контакты! = Стажер).
Поэтому измените это:
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_CONTACTS_TABLE = "create table contacts (id integer primary key not null ," +
" username text not null, name text not null, email text not null,password text not null );";
db.execSQL(CREATE_CONTACTS_TABLE);
this.db = db;
}
на:
@Override
public void onCreate(SQLiteDatabase db) {
String createTraineeTable = "create table trainee (id integer primary key not null ," +
" username text not null, name text not null, email text not null,password text not null );";
db.execSQL(createTraineeTable);
this.db = db;
}
Более того, я бы предложил вам отформатировать строки и использовать определенные вами константы, чтобы избежать подобных ошибок.Например:
String createTraineeTable = String.format("create table %s (%s integer primary key not null, %s text not null, %s text not null, %s text not null, %s text not null", TABLE_NAME , COL_ID, COL_USERNAME, COL_NAME, COL_PASS, COL_EMAIL);