Creating a new SharedPreferences object each time for reading config vars?
<p>Is it acceptable to create a new SharedPreferences object everywhere in code that we want to read config vars?</p>

<pre><code>SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
</code></pre>

<p>I have such code in several methods and classes, and every time a method is called the same code is executed again and again to get just another instance of a SharedPreferences object.</p>

<p>I think I can reduce all of these into one instantiation only, storing that SharedPreferences object into some class var/field and then using the object stored in that var in every other place (Create once and use many times). Probably I can store it in a static field of a separate class dedicated to this purpose and then use that in every other class.</p>

<p>What do u suggest and why?</p>