diff --git a/src/com/fsck/k9/Preferences.java b/src/com/fsck/k9/Preferences.java index cbaa8623b..b364c70b7 100644 --- a/src/com/fsck/k9/Preferences.java +++ b/src/com/fsck/k9/Preferences.java @@ -25,8 +25,9 @@ public class Preferences { private static Preferences preferences; public static synchronized Preferences getPreferences(Context context) { + Context appContext = context.getApplicationContext(); if (preferences == null) { - preferences = new Preferences(context); + preferences = new Preferences(appContext); } return preferences; } diff --git a/src/com/fsck/k9/helper/Contacts.java b/src/com/fsck/k9/helper/Contacts.java index d86362e91..0923c1446 100644 --- a/src/com/fsck/k9/helper/Contacts.java +++ b/src/com/fsck/k9/helper/Contacts.java @@ -31,6 +31,7 @@ public abstract class Contacts { * @return Appropriate {@link Contacts} instance for this device. */ public static Contacts getInstance(Context context) { + Context appContext = context.getApplicationContext(); if (sInstance == null) { /* * Check the version of the SDK we are running on. Choose an @@ -41,9 +42,9 @@ public abstract class Contacts { * The new API was introduced with SDK 5. But Android versions < 2.2 * need some additional code to be able to search for phonetic names. */ - sInstance = new ContactsSdk5p(context); + sInstance = new ContactsSdk5p(appContext); } else { - sInstance = new ContactsSdk5(context); + sInstance = new ContactsSdk5(appContext); } } diff --git a/src/com/fsck/k9/helper/power/TracingPowerManager.java b/src/com/fsck/k9/helper/power/TracingPowerManager.java index 718f7cfdc..471768f17 100644 --- a/src/com/fsck/k9/helper/power/TracingPowerManager.java +++ b/src/com/fsck/k9/helper/power/TracingPowerManager.java @@ -18,11 +18,12 @@ public class TracingPowerManager { private Timer timer = null; public static synchronized TracingPowerManager getPowerManager(Context context) { + Context appContext = context.getApplicationContext(); if (tracingPowerManager == null) { if (K9.DEBUG) { Log.v(K9.LOG_TAG, "Creating TracingPowerManager"); } - tracingPowerManager = new TracingPowerManager(context); + tracingPowerManager = new TracingPowerManager(appContext); } return tracingPowerManager; }