TN.*_*TN. 6 android accounts android-intent android-activity
有什么意图开始显示管理帐户/同步设置活动?查找此类系统活动的意图的最简单方法是什么?
解决方案:感谢来自@ cant0na的提示,启动管理帐户活动:
new Intent("android.settings.SYNC_SETTINGS")
Run Code Online (Sandbox Code Playgroud)
如何查找意图请参阅@ cant0na的答案.
startActivity( new Intent(Settings.ACTION_SYNC_SETTINGS));
Run Code Online (Sandbox Code Playgroud)
您甚至可以使用extra来增强intent,以便只显示具有这些权限的适配器的帐户:
String[] authorities = {"authority1", "authority2"};
Intent intent = new Intent(Settings.ACTION_SYNC_SETTINGS);
intent.putExtra(Settings.EXTRA_AUTHORITIES, authorities);
Run Code Online (Sandbox Code Playgroud)
找到要使用的意图的最简单方法是在手机上打开应用程序时在 eclipse 或 ddms 中的 logcat 中查看。
它看起来像这样:
ActivityManager(2690): Starting: Intent { cmp=com.android.providers.subscribedfeeds/com.android.settings.ManageAccountsSettings } from pid 19036
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3242 次 |
| 最近记录: |