So I followed this tutorial:
How to write a method for making an entry in the tutorial description For the end of a sqlite database tutorial, he says that the method should not be zero and this is the following line:
ourDatabase.insert (DATABASE_TABLE, null, cv);
Really should be returned. It seems that it could work without making a return statement.
I have seen that there are a lot of things in Java examples that processes are done and a return statement is added which seems (me as a newbie) does not make any sense.
Can anyone explain the point of return statement in this case?
The 'insert' function returns a 'long' value, which is the ID of the new line (If everything was okay), or it would return -1, if there was a type of error.
If you want to place the database ID of the item later at some point in the code, then it is necessary that this should be returned to 'long' rather than 'zero'.
No comments:
Post a Comment