Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Android Data Persistence CRUD Operations with SQLite Opening the Database

Zubeyr Aciksari
Zubeyr Aciksari
21,074 Points

Next, add a call to begin a transaction on the database.

Hi, i am stuck in here, please help! Thanks!

CodeChallenge.java
PetSQLiteHelper petSQLiteHelper = new PetSQLiteHelper(context);
petSQLiteHelper.getWritableDatabase();
SQLiteDatabase database = open();
// Also try this but doesn't work database.beginTransaction();

2 Answers

George Pirchalaishvili
George Pirchalaishvili
3,747 Points

You just need to assign database variable like this

SQLiteDatabase database = petSQLiteHelper.getWritableDatabase();
database.beginTransaction();
Zubeyr Aciksari
Zubeyr Aciksari
21,074 Points

Thanks a lot, this worked, "java" doesn't have to be n the code to pass i guess :)