During android development, especially for a beginner like me the creepiest thing which I felt was Handling Contexts. Shared preferences is really a cool thing if we want to save some handy information by the user on a device even if an app is killed. BUT context exceptions are everywhere.
So here we will not go deep into context understanding or preferences documentations. We will only discuss the best approach to use Shared Preference in application from anywhere inside your app. Using this method you can SET or GET preference literally from anywhere
– Mainactivity
– Non-Mainactivity
– Services
– Broadcasts