CaptionsMaker
.com
Room + ViewModel + LiveData + RecyclerView (MVVM) Part 2 - ENTITY - Android Studio Tutorial
Edit Subtitles
Download Subtitles
SRT
TXT
Title:
Description:
In part 2 of the Architecture Components tutorial, we will set up a new Android Studio project, add the Room and Lifecycle dependencies and then create our Note class. By annotating this Java class with @Entity, we can let room generate all the necessary code to create an SQLite table for this object, as well as columns for all it's fields. With @PrimaryKey and autoGenerate = true, we can turn an integer member variable into an autoincrementing primary key, which we can use to uniquely identify each row in the table. In the past we would have to do all of this in an SQLiteOpenHelper with plain SQL statements. Lastly we create a constructor, getters and setters and then Room takes care of creating all the boilerplate code at runtime. We can also specify the tableName if it should be different than the class name. There are some more annotations and settings, like @Ignore and @ColumnInfo, which you can learn more about in the documentation below. Watch the whole playlist: https://www.youtube.com/playlist?list=PLrnPJCHvNZuDihTpkRs6SpZhqgBqPU118 Example code, dependencies & instructions: https://codinginflow.com/tutorials/android/room-viewmodel-livedata-recyclerview-mvvm/part-2-entity AndroidX refactoring table: https://developer.android.com/topic/libraries/support-library/refactor Entity documentation: https://developer.android.com/training/data-storage/room/defining-data ____________________ Subscribe to my channel: https://www.youtube.com/c/codinginflow?sub_confirmation=1 Want more Android tutorials? Check my playlist section: https://www.youtube.com/c/codinginflow/playlists Follow me on social media: Facebook: https://www.facebook.com/codinginflow Instagram: https://www.instagram.com/codinginflow Twitter: https://twitter.com/codinginflow Blog: https://codinginflow.com/
YouTube url:
https://youtu.be/Jwdty9jQN0E
Created:
23. 7. 2019 17:08:40