06-14-2012 12:16 PM
Just add a return false to the catch :
} catch Exception e) {
e.printStackTrace();
return false;
}
Because if it does throw an exception it would not return any result otherwise. But that is java logic, nothing really to do with blackberry coding.
06-14-2012 12:23 PM
Actually even though this is not a blackberry specific point, you should really close the statement and db in a finally block like this:
Cursor crsr = stmt.getCursor();
if (crsr.next())
return true;
else
return false;
} catch (Exception e) {
e.printStackTrace();
return false;
} finally {
if (stmt!=null)
try {
stmt.close();
} catch (DatabaseException e) {
e.printStackTrace();
}
if (db!=null)
try {
db.close();
} catch (DatabaseIOException e) {
e.printStackTrace();
}
}