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

House Trigo
House Trigo
36,620 Points

CRUD Operations with SQLite - Opening the Database - 2 of 2

Can't seem to find the correct solution. Here's my code:

CodeChallenge.java
PetSQLiteHelper petSQLiteHelper = new PetSQLiteHelper(context);
SQLiteDatabase database;
// 1 of 2
petSQLiteHelper.getWritableDatabase();
// 2 of 2
database.beginTransaction();

1 Answer

In the 3rd line above you are calling getWritableDatabase() on petSQLiteHelper But you don't assign it to the database variable.

database = petSQLiteHelper.getWritableDatabase()

That should get you going. Let us know if you're still having trouble

House Trigo
House Trigo
36,620 Points

That's just what I needed. Thanks!