 <blockquote> <p>getDefaultSharedPreferences(Context) in the type PreferenceManager is not applicable for the arguments (DBTools)</p> </blockquote> <p>Because <code>getDefaultSharedPreferences</code> takes Context object as parameters instead of <code>DBTools.this</code> or any other class context.</p> <p>To fix this issue create a private Context object as assign value in object inside <code>DBTools</code> class constructor in which you are passing context when creating object of <code>DBTools</code> class:</p> <pre><code> private Context mContext; public DBTools(Context applicationContext){ super(applicationContext, "contactbook.db", null, 1); this.mContext=applicationContext; } </code></pre> <p>Now, use <code>mContext</code> as parameter to <code>getDefaultSharedPreferences</code> method:</p> <pre><code>SharedPreferences sp = PreferenceManager .getDefaultSharedPreferences(mContext); </code></pre>