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 trialHouse Trigo
36,620 PointsCRUD Operations with SQLite - Opening the Database - 2 of 2
Can't seem to find the correct solution. Here's my code:
PetSQLiteHelper petSQLiteHelper = new PetSQLiteHelper(context);
SQLiteDatabase database;
// 1 of 2
petSQLiteHelper.getWritableDatabase();
// 2 of 2
database.beginTransaction();
1 Answer
James Pamplona
10,015 PointsIn 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
36,620 PointsHouse Trigo
36,620 PointsThat's just what I needed. Thanks!