android sqlite check if inserted new value
insert()
method returns the row ID of the newly inserted row, or -1 if an error occurred.
Change
db.insert(AddNewPhysicalPerson, null, newValues);
like this
long rowInserted = db.insert(AddNewPhysicalPerson, null, newValues);
if(rowInserted != -1)
Toast.makeText(myContext, "New row added, row id: " + rowInserted, Toast.LENGTH_SHORT).show();
else
Toast.makeText(myContext, "Something wrong", Toast.LENGTH_SHORT).show();
long result = db.insert(table name, null, contentvalues);
if(result==-1)
return false;
else
return true;
this is good solution for it..