Use app context for account manager

pull/207/head
M66B 3 years ago
parent 0b14301458
commit 1551b10d0e

@ -276,7 +276,7 @@ public class FragmentGmail extends FragmentBase {
} }
private void onNoAccountSelected(int resultCode, Intent data) { private void onNoAccountSelected(int resultCode, Intent data) {
AccountManager am = AccountManager.get(getContext()); AccountManager am = AccountManager.get(getContext().getApplicationContext());
Account[] accounts = am.getAccountsByType(TYPE_GOOGLE); Account[] accounts = am.getAccountsByType(TYPE_GOOGLE);
if (accounts.length == 0) if (accounts.length == 0)
Log.e("newChooseAccountIntent without result=" + resultCode + " data=" + data); 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); final String disabled = getString(R.string.title_setup_advanced_protection);
boolean found = false; boolean found = false;
AccountManager am = AccountManager.get(getContext()); AccountManager am = AccountManager.get(getContext().getApplicationContext());
Account[] accounts = am.getAccountsByType(type); Account[] accounts = am.getAccountsByType(type);
for (final Account account : accounts) for (final Account account : accounts)
if (name.equalsIgnoreCase(account.name)) { if (name.equalsIgnoreCase(account.name)) {

Loading…
Cancel
Save