当用户尝试连接到GoogleDrive进行下载时,会显示身份验证表单,w用户google帐户...当用户单击“确定”时工作正常,但如何捕获“取消”按钮单击以将意图发送给另一个活动......? 唯一的检查是“onItemClick”......
// Connect to Google Drive, access to all files
mCredential = GoogleAccountCredential.usingOAuth2(this, Arrays.asList(DriveScopes.DRIVE));
startActivityForResult(mCredential.newChooseAccountIntent(), REQUEST_ACCOUNT_PICKER);
OnItemClickListener mMessageClickedHandler = new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
downloadItemFromList(position);
finish();
}
};
我试图捕获取消异常,但不接受
try {
mCredential = GoogleAccountCredential.usingOAuth2(this, Arrays.asList(DriveScopes.DRIVE));
} catch (OperationCanceledException e) {
e.printStackTrace();
return;
} catch (AuthenticatorException e) {
e.printStackTrace();
return;
} catch (IOException e) {
e.printStackTrace();
return;
}
我不确定哪个取消操作正在捕捉...
答案 0 :(得分:0)
我应该处理onActivityResult {}的责任 该死的!为时已晚......停止为今天工作