Google Accounts Picker Not Showing Up

732 views Asked by At

I can not for the life of me figure out why, but my google account intent isn't showing up in a popup dialog. Here is my code and I can provide more of it if needed.

public class MainMenu extends ActionBarActivity implements ActionBar.TabListener {
//... Fragment Code
Intent googlePicker = AccountPicker.newChooseAccountIntent(null, null,
            new String[]{GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE}, true, null, null, null, null);
    startActivityForResult(googlePicker, 1);
}

@Override
protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
    if (requestCode == 1 && resultCode == RESULT_OK) {
        String accountName = data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME);
        Log.d(this.getClass().toString(), "Account Name=" + accountName);
    }
}
1

There are 1 answers

0
flosk8 On

If you are in a Fragment use

...
getActivity().startActivityForResult(googlePicker, 1);
...