From 1551b10d0e04854a52b9c2d48a6e76c6464fbe1c Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 18 Apr 2022 08:24:19 +0200 Subject: [PATCH] Use app context for account manager --- app/src/main/java/eu/faircode/email/FragmentGmail.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentGmail.java b/app/src/main/java/eu/faircode/email/FragmentGmail.java index 0e8a6352f9..bf22820d7c 100644 --- a/app/src/main/java/eu/faircode/email/FragmentGmail.java +++ b/app/src/main/java/eu/faircode/email/FragmentGmail.java @@ -276,7 +276,7 @@ public class FragmentGmail extends FragmentBase { } private void onNoAccountSelected(int resultCode, Intent data) { - AccountManager am = AccountManager.get(getContext()); + AccountManager am = AccountManager.get(getContext().getApplicationContext()); Account[] accounts = am.getAccountsByType(TYPE_GOOGLE); if (accounts.length == 0) Log.e("newChooseAccountIntent without result=" + resultCode + " data=" + data); @@ -296,7 +296,7 @@ public class FragmentGmail extends FragmentBase { final String disabled = getString(R.string.title_setup_advanced_protection); boolean found = false; - AccountManager am = AccountManager.get(getContext()); + AccountManager am = AccountManager.get(getContext().getApplicationContext()); Account[] accounts = am.getAccountsByType(type); for (final Account account : accounts) if (name.equalsIgnoreCase(account.name)) {