0
How do I not add to the database when the String dia is null ?
Code :
public boolean insertData(String disciplina,String sala,String dia,String hora){
ContentValues values = new ContentValues();
values.put(COL_2,disciplina);
values.put(COL_3,sala);
values.put(COL_4,dia);
values.put(COL_5,hora);
long result = database.insert(TABLE_NAME,null,values);
if(result==-1){
return false;
}else
return true;
}
NOT NULL in the database column
– user60252
What do you mean ? You can elaborate on a response ?
– Emanuel Sobreiro
when creating the database table, have column Name Datatype NOT Nulll Flags Default Value Comment, just tick NOT NULL
– user60252