Building a Wishlist App: My Journey with Room Database, DAO, and Entity Integration

Day 14 of My Android Development Journey: Diving into Room Database, DAO, and More! It’s been an incredibly productive day in my Android development journey! Today, my instructor, Sir Denis Panjuta, took us through some critical aspects of Android app development, specifically focusing on the Room Database, DAO (Data Access Object), and Entity. Here's a detailed rundown of everything I learned and accomplished: Storage Options in Android Development We started the day with an overview of the various storage options available in Android development. Sir Denis explained the different ways to store data - from shared preferences and internal storage to external storage and databases. This provided a solid foundation for understanding why we use databases in more complex applications. Introduction to the Room Database Next up was the Room Database, which is a part of Android's Architecture Components. Sir Denis walked us through the basics, explaining how Room provides an abstraction layer over SQLite to allow for more robust database management. We discussed the following components: Entity: Represents a table within the database. Each entity has fields that correspond to columns in the table. DAO (Data Access Object): This serves as an interface containing methods to access the database, such as inserting, updating, or deleting data. RoomDatabase: This is the database holder and serves as the main access point for the underlying connection to the app's persistent data. Creating DAO, Database, and Repository Moving forward, we dove into practical implementation. Sir Denis guided us through the steps to create a DAO, a Database, and a Repository: DAO: We created different methods using annotations like @Insert, @Update, @Delete, and @Query for various data operations. Database: Next, we defined the RoomDatabase class by specifying entities and the database version. Repository: Finally, we created a repository to manage queries and allow the rest of the app to use them effortlessly. Completing the WishList App One of the significant milestones for today was completing our WishList app by effectively implementing the Room Database. This project helped me consolidate all the concepts I learned: Entity, DAO, and RoomDatabase: Implemented a WishListItem as our entity and created DAO methods to manage WishList data. Repository and ViewModel: Set up a repository to bridge the gap between the data layer and UI layer, integrating it with the ViewModel for better lifecycle management. Learning Graph Class and Snackbars On top of the core database concepts, I also learned about the Graph class and Snackbars: Graph Class: Explored how to visualize data using the Graph class, providing dynamic and intuitive representations within the app. Snackbars: Discovered how to use Snackbars to provide lightweight feedback to users, integrating these into our app for a better user experience. Swipe to Delete Feature One of the fun and interactive features we added today was the Swipe to Delete functionality. This allows users to swipe on a list item to remove it from the database, enhancing the app's user experience with intuitive gestures. ** ** Today was undoubtedly a bit lengthy, but every minute was packed with valuable knowledge. Understanding and implementing the Room Database, DAO, and other components have significantly broadened my Android development skills. I am excited to continue this journey and eager to see how these concepts will come together in future projects. Thanks for following my journey! Stay tuned for more updates as I dive deeper into the world of Android development.

Jan 17, 2025 - 14:20
Building a Wishlist App: My Journey with Room Database, DAO, and Entity Integration

Day 14 of My Android Development Journey: Diving into Room Database, DAO, and More!

It’s been an incredibly productive day in my Android development journey! Today, my instructor, Sir Denis Panjuta, took us through some critical aspects of Android app development, specifically focusing on the Room Database, DAO (Data Access Object), and Entity. Here's a detailed rundown of everything I learned and accomplished:

Storage Options in Android Development
We started the day with an overview of the various storage options available in Android development. Sir Denis explained the different ways to store data - from shared preferences and internal storage to external storage and databases. This provided a solid foundation for understanding why we use databases in more complex applications.

Introduction to the Room Database
Next up was the Room Database, which is a part of Android's Architecture Components. Sir Denis walked us through the basics, explaining how Room provides an abstraction layer over SQLite to allow for more robust database management. We discussed the following components:

Entity: Represents a table within the database. Each entity has fields that correspond to columns in the table.

DAO (Data Access Object): This serves as an interface containing methods to access the database, such as inserting, updating, or deleting data.

RoomDatabase: This is the database holder and serves as the main access point for the underlying connection to the app's persistent data.

Creating DAO, Database, and Repository
Moving forward, we dove into practical implementation. Sir Denis guided us through the steps to create a DAO, a Database, and a Repository:

DAO: We created different methods using annotations like @Insert, @Update, @Delete, and @Query for various data operations.

Database: Next, we defined the RoomDatabase class by specifying entities and the database version.

Repository: Finally, we created a repository to manage queries and allow the rest of the app to use them effortlessly.

Completing the WishList App
One of the significant milestones for today was completing our WishList app by effectively implementing the Room Database. This project helped me consolidate all the concepts I learned:

Entity, DAO, and RoomDatabase: Implemented a WishListItem as our entity and created DAO methods to manage WishList data.

Repository and ViewModel: Set up a repository to bridge the gap between the data layer and UI layer, integrating it with the ViewModel for better lifecycle management.

Learning Graph Class and Snackbars
On top of the core database concepts, I also learned about the Graph class and Snackbars:

Graph Class: Explored how to visualize data using the Graph class, providing dynamic and intuitive representations within the app.

Snackbars: Discovered how to use Snackbars to provide lightweight feedback to users, integrating these into our app for a better user experience.

Swipe to Delete Feature
One of the fun and interactive features we added today was the Swipe to Delete functionality. This allows users to swipe on a list item to remove it from the database, enhancing the app's user experience with intuitive gestures.

**
Image description**
Today was undoubtedly a bit lengthy, but every minute was packed with valuable knowledge. Understanding and implementing the Room Database, DAO, and other components have significantly broadened my Android development skills. I am excited to continue this journey and eager to see how these concepts will come together in future projects.

Thanks for following my journey! Stay tuned for more updates as I dive deeper into the world of Android development.