Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8521183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:44:54+00:00 2026-06-11T06:44:54+00:00

SO I am writing a database manager for android, and in that class will

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T06:44:56+00:00Added an answer on June 11, 2026 at 6:44 am

    just put the catch block before the finally block

    SQLiteDatabase db = this.getReadableDatabase();
            db.beginTransaction();
            try {
              //DO some db writing
              db.setTransactionSuccessful();
            }catch(Exception e){
               // here you can catch all the exceptions
               e.printStack();
            } finally {
              db.endTransaction();
            }
    

    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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a database app, that is going to pull out some data and
I am writing an application that will move data from one database to another
This is my first attempt at writing a program that accesses a database from
I know that Heroku is running the rake assets:precompile task: -----> Writing config/database.yml to
I'm writing an Access database. I have a number of forms that are identical.
I am writing an app with a database that has a slightly unusual schema.
I am writing a Web Service to retrieve Invoice information from a database table.
I am thinking of writing a tool that will list all the tables in
I'm writing an application for the iPhone that communicates with a SQLite database but
I am writing a Django application that will track changes to the models, in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.