When to use the static variable and shared preference in Android

advertisements

When to use static variable and sharedpreference in android. Which is the best to use. Can anyone explain with example. Thanks in advance.


You can use static when there is not huge amount of data in the application. sharedpreference can be used if the data is more also and can be stored and retrieved as and when it is required.