Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 谷歌账户选择器没有出现_Android_Dialog_Google Account_Accountpicker - Fatal编程技术网

Android 谷歌账户选择器没有出现

Android 谷歌账户选择器没有出现,android,dialog,google-account,accountpicker,Android,Dialog,Google Account,Accountpicker,我一辈子都不知道为什么,但我的谷歌账户意图并没有出现在弹出的对话框中。这是我的代码,如果需要,我可以提供更多 public class MainMenu extends ActionBarActivity implements ActionBar.TabListener { //... Fragment Code Intent googlePicker = AccountPicker.newChooseAccountIntent(null, null, new Strin

我一辈子都不知道为什么,但我的谷歌账户意图并没有出现在弹出的对话框中。这是我的代码,如果需要,我可以提供更多

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);
    }
}

如果您处于片段中,请使用

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