我如何在Android中使用客户经理获取我尝试过的推特账号
AccountManager am = AccountManager.get(getApplicationContext());
Account[] accts = am.getAccountsByType("com.twitter.android.oauth.token");
Log.d("Accounts ", ""+accts.length);
if(accts.length > 0) {
Account acct = accts[0];
Log.d("Account IF", ""+acct);
am.getAuthToken(acct, "com.twitter.android.oauth.token", null, (Activity) getApplicationContext(), new AccountManagerCallback<Bundle>() {
@Override
public void run(AccountManagerFuture<Bundle> arg0) {
try {
Bundle b = arg0.getResult();
Log.e("TrendDroid", "THIS AUTHTOKEN: " + b.getString(AccountManager.KEY_AUTHTOKEN));
} catch (Exception e) {
Log.e("TrendDroid", "EXCEPTION@AUTHTOKEN");
}
}}, null);
但我的行为长度为零如何解决这个问题以获取推特账号