How to start activity Manage Accounts / Sync Settings on Android?
What intent to start to show Manage Accounts / Sync Settings activity? What is the easiest way to lookup intents for such system activities?
SOLUTION: T开发者_JS百科hanks to hint from @cant0na, to start Manage Accounts activity:
new Intent("android.settings.SYNC_SETTINGS")
How to lookup intents see @cant0na's answer.
startActivity( new Intent(Settings.ACTION_SYNC_SETTINGS));
you can even enhance the intent with extra,so that only accounts that have adapters for those authorities are displayed:
String[] authorities = {"authority1", "authority2"};
Intent intent = new Intent(Settings.ACTION_SYNC_SETTINGS);
intent.putExtra(Settings.EXTRA_AUTHORITIES, authorities);
The easiest way to find which intents to use is to see in logcat in eclipse or ddms while opening the app on your phone.
It will look something like this:
ActivityManager(2690): Starting: Intent { cmp=com.android.providers.subscribedfeeds/com.android.settings.ManageAccountsSettings } from pid 19036
as @cant0na said that is the best way. the alternative would be going through the source code or for some of the available intents that you can register you can go to the manifest and set a intent filter and in the GUI of the manifest there are some of the available actions listed to add to the intent filter.
also this link has all of them listed with explanations:
Intent Reference
精彩评论