Code example for AccountManagerFuture

Methods: getResultisCancelledisDone

0
    { 
        public void run(AccountManagerFuture<Bundle> future)
        { 
            Log.i(TAG, "select:"+future);
            try { 
                Bundle bundle = future.getResult();
                Log.i(TAG, "flags:"+future.isDone()+","+future.isCancelled());
                Intent intent = (Intent)bundle.get(AccountManager.KEY_INTENT);
                Log.i(TAG, "intent:"+intent);
                if (intent != null) {
                    startActivity(intent);
                } 
                else { 
                    String token = bundle.getString(AccountManager.KEY_AUTHTOKEN);
                    Log.i(TAG, "token:"+token);
                } 
            } catch (OperationCanceledException e) {
                Log.e(TAG, "operation canceled", e);
            } catch (IOException e) {
                Log.e(TAG, "I/O error", e);
Experience pair programming with AI  Get Codota for Java