SO I am writing a database manager for android, and in that class will be a method for writing to a table of that database..
SQLiteDatabase db = this.getReadableDatabase();
db.beginTransaction();
try {
//DO some db writing
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
my understanding is that this will automatically rollback the data should the transaction not be set to successful as it is in the try, but how do i catch if it was not successful so i can notify the user on success or rollback
just put the catch block before the finally block
examples for try catch
http://www.java-samples.com/showtutorial.php?tutorialid=293
http://tutorials.jenkov.com/java-exception-handling/basic-try-catch-finally.html