这是我的代码。
Intent i=new Intent();
try {
i.setClassName(this, (Settings.ACTION_ADD_ACCOUNT));
startActivity(i);
}
catch(Exception e) {
e.printStackTrace();
}
我收到空指针异常。请帮忙
最佳答案
试试这个
Intent intent=new Intent(Settings.ACTION_SYNC_SETTINGS);
startActivity(intent);
添加gmail
您可以使用 AccountManager .
AccountManager acm = AccountManager.get(getApplicationContext());
acm.addAccount("com.google", null, null, null, thisclassname.this,
null, null);
关于android - 如何以编程方式调用android中的帐户设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13639976/