Room Database & Type Converters in Android | Singleton Pattern Room Hindi- CheezyCode #11

  Рет қаралды 31,131

Cheezy Code

Cheezy Code

Күн бұрын

Learn Type Converters in Android Room Database. Learn how to implement a singleton pattern for Room Database in Kotlin to have a single instance of the database for the whole application. Room Persistence library is like an ORM tool that helps in storing entities directly into the database. SQLite supports limited data types, to support custom data types or other types such as Date or UUID - we need TypeConverters.
Learn how to use companion object with @Volatile and synchronized block in Kotlin. Learn how to use SQLite in Android using Room Jetpack Architecture Components. Learn all this about Android Jetpack Components in Hindi by creating small projects.
These components help in writing clean code and help in following clean architecture in android. Learn all this about Android in Hindi by creating small projects. Everything is explained in Hindi (हिंदी में )
Topics Covered -
1. Singleton Pattern in Kotlin
2. Thread Safe Singleton pattern implementation - Room Database
3. Need of Singleton
4. TypeConverters (@TypeConverter, @TypeConverters) in Android Room
5. Simple Example of Room Database
Kotlin Companion Object Video -
• Kotlin Companion Objec...
ViewModel Concept -
• Android ViewModel Tuto...
ViewModelFactory -
• Android ViewModel Fact...
Beginner series in Android Playlist (Hindi) -
• Android Tutorials Step...
Kotlin Beginners Tutorial Series -
• Kotlin Beginner Tutori...
For more info - visit the below link
www.cheezycode.com
We are social. Follow us at -
Facebook - / cheezycode
Twitter - / cheezycode
Instagram - / cheezycode

Пікірлер: 84
@preetamgupta3532
@preetamgupta3532 3 жыл бұрын
सर आपके बताने का तरीका बहुत अच्छा हैं।🙏 अच्छे से चीजे समझ आती है। Thanku Sir
@CheezyCode
@CheezyCode 3 жыл бұрын
Thank you 🤘
@sarkheelmughal6545
@sarkheelmughal6545 3 жыл бұрын
this playlist helps me a lot. kindly cover all other jetpack topics as soon as possible especially MVVM. thanks for such content.
@CheezyCode
@CheezyCode 3 жыл бұрын
Thank you 🤘 and mvvm for sure
@Maheshl43
@Maheshl43 Жыл бұрын
@@CheezyCode waiting
@kt_radhakishan
@kt_radhakishan 2 жыл бұрын
Nice job sir 👍 Your tutorial is very helpful. Love you ❤️❤️ so much ❣️ sir Love from Indore Madhya Pradesh.
@Punarjagran
@Punarjagran 3 жыл бұрын
BLESSED TO FIND YOU.. I SPREAD THESE VIDEOS & THIS BRAND / CHANNEL A LOTTT
@CheezyCode
@CheezyCode 3 жыл бұрын
Thank you 🤘...aapka din shubh ho 😁
@Punarjagran
@Punarjagran 3 жыл бұрын
@@CheezyCode aapka bhi 🙏✨
@ShivamPatel-vp5pb
@ShivamPatel-vp5pb Жыл бұрын
Amazing Explanation Sir ❤🫡
@kishorramani007
@kishorramani007 3 жыл бұрын
Thanks 🙌 Ending music and song is nice 🙂
@CheezyCode
@CheezyCode 3 жыл бұрын
Thanks
@BCS_AAMIRASHRAF
@BCS_AAMIRASHRAF Жыл бұрын
thanku sir just amazing❤❤❤
@CheezyCode
@CheezyCode Жыл бұрын
@saurabhpandey9077
@saurabhpandey9077 3 жыл бұрын
Bht se resources available hai android development ko le k in the form of videos, articles post etc. But the way you explain is just amazing ek bar me hi smjh aa jata hai and i am sure all 40.5K subscribers will be agree with me You are awesome Thank you so much. and my humble request is that can you please videos on Dagger hilt
@CheezyCode
@CheezyCode 3 жыл бұрын
Thanks Saurabh....Dependency Injection and Coroutines will be next....stay tuned
@vidhidixit5003
@vidhidixit5003 2 жыл бұрын
Always Well Explained !! Thanks
@CheezyCode
@CheezyCode 2 жыл бұрын
Thanks Vidhi
@moeed1584
@moeed1584 3 жыл бұрын
very much helpful contents Thanks sir
@CheezyCode
@CheezyCode 3 жыл бұрын
Thanks Abdul
@gajukollur7591
@gajukollur7591 Жыл бұрын
Sir , why companion object... we can directly achieve singleton using just object
@Subratsss
@Subratsss 7 ай бұрын
Very good explanation
@Sikarwar0020
@Sikarwar0020 3 жыл бұрын
Sir Coroutines ko bhi details me explain kr dena.. I am really enjoying this playlist.
@CheezyCode
@CheezyCode 3 жыл бұрын
Sure bro...Coroutines pe dil se content ban rha hai....poori koshish
@Sikarwar0020
@Sikarwar0020 3 жыл бұрын
@@CheezyCode thanks a lot 😇
@sat_talk
@sat_talk 2 жыл бұрын
Great video.. keep it up. After finishing this series pl. make a series on Firebase Push Notification ( especially when app is no longer in background). I found many videos on that but they only showed either foreground or background scenarios.. no video found based on how to get Notification when app is no longer running in background which is realtime case ..
@CheezyCode
@CheezyCode 2 жыл бұрын
Noted
@dogsgallery2199
@dogsgallery2199 3 жыл бұрын
Thnx for everything cheezy code
@CheezyCode
@CheezyCode 3 жыл бұрын
Thank you 🤘
@Maheshl43
@Maheshl43 Жыл бұрын
Love you don't stop
@arjundixit5913
@arjundixit5913 3 жыл бұрын
Nice explanation. Just one confusion, as mentioned by you in kotlin tutorial , object is used to create a synchronised singleton instance, then why are we again using the java way to create singleton inside the companion object ? I mean is it not defeating the whole purpose of it?
@CheezyCode
@CheezyCode 3 жыл бұрын
It all depends how you access the object. If you access the object in the application class, you can define simple object declaration that will work. But we are accessing it with in activity - it is better to have thread safe singleton.
@arjundixit5913
@arjundixit5913 3 жыл бұрын
@@CheezyCode Sorry bhai but samjh nhi aaya..firstly ki object b toh thread safe hota h na? secondly activiy me aisi kya problem h jis wjah se simple object decalaration will not work...but will work in application? pls agar aap thoda detail m smjha sko because i want to clear my concepts
@sunilkumar-zl6eo
@sunilkumar-zl6eo 3 жыл бұрын
Great Teaching sir.....if possbile please provide the content "like website" for new video so that we can prepare for interview.........please sir...
@CheezyCode
@CheezyCode 3 жыл бұрын
bilkul bro koshish karte hai...
@rabindratiduar728
@rabindratiduar728 Жыл бұрын
❤❤❤❤
@mubaraknative
@mubaraknative Жыл бұрын
Bro in this 6:41 typeconvertor we convert Data to Long for inserting for Fetching Long to Data is used when i will use in my real application the data will show as like this Wed jul 29 19:24:54 GMT + 05:30 2023 simply i want to format the data how to do that bro how to format like DD/MM/YY only
@CheezyCode
@CheezyCode Жыл бұрын
Just google it
@CheezyCode
@CheezyCode Жыл бұрын
stackoverflow.com/a/61410177
@CheezyCode
@CheezyCode Жыл бұрын
stackoverflow.com/a/11773496
@gamenation9222
@gamenation9222 3 жыл бұрын
Thank you #CheezyCode
@CheezyCode
@CheezyCode 3 жыл бұрын
Thank you 🤘
@jineshsharma2780
@jineshsharma2780 6 ай бұрын
Sir how to create the type convertor for Files and images
@mohammadtaqi4051
@mohammadtaqi4051 2 жыл бұрын
Database me agar 2 column me long value ho to kya dono long value to time me convert karega? Agr nahi to fir usko kese pata chalega k konsi long column ke liye ye converter use krna hai?
@CheezyCode
@CheezyCode 2 жыл бұрын
Datatypes same hai toh converter chalega...aur ye try karo - clarity jabhi aayegi...question toh answer hojayege
@deepeshkumar1704
@deepeshkumar1704 Жыл бұрын
If we have multi type converter, then how compiler know, which type converter they have to use??
@deepeshkumar1704
@deepeshkumar1704 Жыл бұрын
cheked your replies on previous comments, found solution, Thanks❤
@deepeshkumar1704
@deepeshkumar1704 Жыл бұрын
but if you have another way to explain now, pls Thanks❤
@H1MANSHU
@H1MANSHU 2 жыл бұрын
7:34 ; at this point , I think stupids like me will definitely select @TypeConverters in place of @TypeConverter as it was suggested first , which is going to throw a compile time error !
@rashidullah1412
@rashidullah1412 Жыл бұрын
sir why suspend is not working when i removed suspend work properly but is still there is not there in background thread how shou;d i do sir
@pankajgupta8211
@pankajgupta8211 2 жыл бұрын
Sir, this code this work only one time when i again run the program the app is crashing please help i cannot find out the problem i done all the things correctly .
@anujvaish2513
@anujvaish2513 2 жыл бұрын
Bhai gana bahut acha hai
@CheezyCode
@CheezyCode 2 жыл бұрын
50k pe release karna h
@ChocoByte
@ChocoByte 2 жыл бұрын
Here, you made a convertor for date, but how to make convertor for any different types or any custom class. I need a convertor for type FILE
@CheezyCode
@CheezyCode Жыл бұрын
Convert that to Binary...but I would suggest not to store that in DB...store it as a file only - just store the file name inside sqlite
@ChocoByte
@ChocoByte Жыл бұрын
@@CheezyCode" store it as file only" ? Data type "File" is not available in DB....then how...?
@dumbguy1073
@dumbguy1073 2 жыл бұрын
How will that automatically convert from date to long and long to date?????
@BhardwajHackology
@BhardwajHackology 2 жыл бұрын
same question, how does it know when to Convert what to convert, we didnt define it here
@CheezyCode
@CheezyCode 2 жыл бұрын
Primitive types don't need conversion Whenever it encounters types other than primitives - it looks for type converters. If type converters are present, it uses these functions to convert values, otherwise will throw an error.
@BhardwajHackology
@BhardwajHackology 2 жыл бұрын
@@CheezyCode means It will look for a function that takes data type that needs to be converted, if it is present then it will use that function right ?
@CheezyCode
@CheezyCode 2 жыл бұрын
Yes...check type converters documentation
@BhardwajHackology
@BhardwajHackology 2 жыл бұрын
@@CheezyCode Sure, I’ll check, Thanks for your time 🫶
@GAGANDEEP901
@GAGANDEEP901 3 жыл бұрын
can anyone answer, this is SQLlite right?
@CheezyCode
@CheezyCode 3 жыл бұрын
Yes behind the scenes it is SQLite
@raokarampal
@raokarampal 3 жыл бұрын
Bhai vo converter wale fun jo banaye hai vo call kaha se kiye hai date ko change karne ke liye? Smaj nahi aaya yaar? 🤔 7:58 ke baad samaj nahi aaya
@CheezyCode
@CheezyCode 3 жыл бұрын
Room apne aap call karta hai...contactdatabase pe typeconverters ki annotation add kari h
@raokarampal
@raokarampal 3 жыл бұрын
@@CheezyCode uske kaise pata kon sa call karna hai matlab agar m usme ek or fun rakhu FromlongtoString(value :Long) : string{ return str(value) } To kya hoga?
@CheezyCode
@CheezyCode 3 жыл бұрын
Bro data type check hota hai.... function jisme date type ka input ho, wo use hoga... Fir jab wapsi long jisme input hoga wo use hoga..room check karta hai data type dekh ke
@CheezyCode
@CheezyCode 3 жыл бұрын
Entity ke andar jo field h uska type bhi toh dekhega...string banane se date type kaise milega
@CheezyCode
@CheezyCode 3 жыл бұрын
Acha aise samajh skte ho - Room ne dekha entity ke andar date hai...usne kaha date store nahi kar skta - convertors pe pahocha usne dekha - koi aisa function jo input mei date le rha ho...usse mila ek function jo date ko long mei convert kar rha tha.... Ab access kar rha hu database se - value mili long usne kaha long ke liye koi aisa method hai jo date mei convert kar rha ho - usse mil gya - usko use kar liya usne
@dogsgallery2199
@dogsgallery2199 3 жыл бұрын
React native oe video banaiye
@historicalheros9684
@historicalheros9684 3 жыл бұрын
jab me database me data insert karta hu to app crash ho jata he , muje pata nahi kyu. aap help kar sakte ho
@CheezyCode
@CheezyCode 3 жыл бұрын
Check the logcat for the error
@SachaHindu88
@SachaHindu88 2 жыл бұрын
Little Correction fun getInstance(context: Context): ContactDatabase { if (INSTANCE == null) { synchronized(this) { if (INSTANCE == null) { INSTANCE = Room.databaseBuilder( context.applicationContext, ContactDatabase::class.java, "ContactDB" ).build() } } } return INSTANCE!! }
@deepsheth1086
@deepsheth1086 2 жыл бұрын
why another if in inside ?
@rishabhgupta655
@rishabhgupta655 2 жыл бұрын
gana ka kya naam h mil nahi raha h
@CheezyCode
@CheezyCode 2 жыл бұрын
Gaana karege release...inhouse h
Room Database & Migrations in Android Hindi - CheezyCode #12
9:00
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
#2 How to use Hilt with Room Database ( Complete guide  )
1:04:03
Android Geek
Рет қаралды 4,2 М.
Database and Room TypeConverter - MVVM News App
9:43
Philipp Lackner
Рет қаралды 36 М.
🔥3 Ways to break singleton pattern | Solution of Problem in detail | Hindi
18:36
Room Database - Using Foreign Keys!
10:05
Charfaoui Younes
Рет қаралды 3,4 М.
Solving one of PostgreSQL's biggest weaknesses.
17:12
Dreams of Code
Рет қаралды 220 М.
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН