可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I spent several hours by searching correct Intent for launching Data usage Activity in Android Settings. Unfortunetly i found nothing (on web and also here).
I also tried reflection (in a case of private field) but also without result. I will be glad for any help.
Thanks in advance.
回答1:
Try...
Intent intent = new Intent(); intent.setComponent(new ComponentName( "com.android.settings", "com.android.settings.Settings$DataUsageSummaryActivity")); startActivity(intent);
This worked for me. I found it from the link to data usage in the KitKat QuickSettings source code.
回答2:
If you take a look at Android Settings manifest file and find activity section named "Settings$DataUsageSummaryActivity", it doesn't seem like it has an intent for being launched. Its intent filter has only one action tag(MAIN).
In Settings/AndroidManifest.xml,
...
As you can see in this code, there is no custom action intent defined here.
回答3:
Take a look at Android Intents. They are talking about a ACTION_MANAGE_NETWORK_USAGE Intent.