title: SharedPreferences application context vs activity context
body: <p>I am using several SharedPreferences to store data in my app.
  Some preferences are used in a lot of activites. </p>
  
  <p>I know that the SharedPreferences are internally backed by a map for fast read-access and written to sdcard when settings are changed.</p>
  
  <p>I wonder which way is better if a sharedpreference is accessed by a lot of activies:</p>
  
  <ol>
  <li>Instantiate it in every activity using the activity context.</li>
  <li>Instantiate it in every activity, but using the application context.</li>
  <li>Put it in e.g. the Application class and instantiate it only once there, similar to a singleton.</li>
  </ol>
  
  <p>If I use 1. solution is there a sharedpreference object for every activity? And will the sharedpreference's internal map get destroyed when the activity is destroyed?</p>
  
  <p>If I use 2. solution will there be only one instance although I call getSharedPreferences in every activity? And will the internal map be in memory as long as the application is alive?</p>
  
  <p>Hopefully someone knows how Android handles it internally.</p>