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 "shared preferences" in Android ?
FragmentPagerAdapter deprecated, Since API 27.1.0 FragmentPagerAdapter is deprecated.
Intent for Drive PDF Viewer - How to open PDF in Google Drive with intent
Could not inflate Behavior subclass android.support.design.widget. BottomSheetBehavior How resolve
Is There A Way To Get The Source Code From An APK File? (or) How to decompile apk?
Explain Fragment Life Cycle
Duplicate files during packaging of APK” build.gradle issue: Android Studio
ERROR Android emulator gets killed when I try to run my application and choose an emulator it ret
Google play store rejected my app due to SMS permission I removed SMS permission from the manifes
How to Generate signed apk with android studio
What are the notifications available in android?
How to extract date and time from Long type variable in Kotlin on Android "
How to find Android Device UDID or unique ID?
Hide/Disable soft keyboard on Activity launch: Android
What is NetworkOnMainThread Exception?
How to save activity State in Android?
Check List for Generate Signed APK Android
What happens next when the device switches between portrait and landscape?
'constructor Handler()' is deprecated. Deprecated in Java, How to use Handler() class in And
How to Exit android app on back pressed?
How to start a new activity on button click
Key Points to remember while develop the Android Application.
What is Android Fragments?
How do I check in SQLite whether a table exists?
What is Android?
How to avoid multiple button click at same time in android?
Android FCM not receiving notifications when app is removed from background
How to validate email address in Android with Kotlin?
How to Get bitmap from drawable: Android
How To Set Text Color Programmatically Android TextView?
What is ANR in android?
What are symmetric and asymmetric encryption in the way Android interacts with the server?
What is Application?
Error: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path
What is the difference between match_parent and fill_parent?
How to install/ uninstall apk by command line ADB
How to check Android version?
What is ANR? How to avoid and resolve it?
How to get screen size (width,height) in Android?
How to get a contact image using a phone number in android?