Context is an abstract class, whose implementation is provided by Android System. It provide acces to application related resources,databses,shared preferences... We have different ways to access the context. When to use getContext()? Any instance which is not running long time, there we can use getContext(). We can use it in long running instances but we need to hanlde it by theire lifecycle methods to avoid memory leaks. When to use getBaseContext()? Inside activity life cycle we can use the getBaseContext(), this will be lives until the activity lifecycle alive. When to use getApplicationContext()? getApplicationContext() returns the application context of entire application. It will live untile the application life cycle, once application terminated it will destory When to use getThemedContext()? This context will be used to hanlde the views theme context inside the actionbar. Note: we have to use proper context on the lifecycle of each instance to avoid the memory leaks in the application.
What is Android Fragments?
Check List for Generate Signed APK Android
How to Exit android app on back pressed?
How to stop EditText focus at Activity startup in Android?
Set Activity to Fullscreen Mode in Android - RRutors
INSTALL_FAILED_INVALID_APK: Split lib_slice_9_apk was defined multiple times. It is possible that th
Add Jar/Library Files as Dependency in Android Studio
How to save activity State in Android?
How to install/ uninstall apk by command line ADB
How do i load image from drawable folder in Jetpack Compose?
How To Set Text Color Programmatically Android TextView?
Emulator: emulator: ERROR: Can't find 'Linux version ' string in kernel image file: Andr
What are Android Versions available?
What is NetworkOnMainThread Exception?
What is the Different Between val and var in Kotlin?
How to validate email address in Android with Kotlin?
How to get screen size (width,height) in Android?
Android Studio project R can't find
Fix Behavior Subclass BottomSheetBehavior Exception - RRutors
How to copy database from assets folder in android using kotlin
Hide/Disable soft keyboard on Activity launch: Android
How to Get bitmap from drawable: Android
Key Points to remember while develop the Android Application.
What are the notifications available in android?
How to get complete address from latitude and longitude?
How to Use Deprecated Handler() in Android - RRutors Guide
Fix Duplicate Files in APK Build.gradle Issue - RRutors
What is Intent? What is the difference between an implicit intent and an explicit intent?
How can i comment inside xml file in android studio?
How to avoid multiple button click at same time in android?
FCM Not Receiving Notifications in Android - RRutors
How to get a contact image using a phone number in android?
How to check Android version?
How do I check in SQLite whether a table exists?
Fix Play Store Rejection Due to SMS Permission - RRutors
Invoke-customs are only supported starting with android 0 --min-api 26
Extract Date and Time from Long Type Variable - RRutors
How to reduce APK package size?
Fix Android Emulator Kill Error When Running Your App
What is "shared preferences" in Android ?