创建和QUOT;电池使用"意图安卓
问题描述:
在我的Nexus One,有来自设置>关于手机>电池使用一个方便的应用程序访问。
On my nexus one, there is a handy app reachable from Settings > About Phone > Battery use.
我想给startActivity()从我的活动一个应用程序。
I'd like to StartActivity() that app from one of my Activities.
我的日志,当设置运行它,这个意图是记录在看
I can see in the log that when Settings runs it, this intent is logged:
Starting activity:
Intent { act=android.intent.action.MAIN
cmp=com.android.settings/.fuelgauge.PowerUsageSummary }
我在与麻烦的东西在Android的Java源代码。我甚至无法找到在GIT源fuelgauge。任何人都可以点我正确的文件,或其他任何有帮助的,比如如何建立正确的意向?
I'm having trouble relating that to something in Android Java source. I can't even find "fuelgauge" in the GIT source. Can anyone point me to the right file, or anything else helpful, like how to create the right kind of Intent?
感谢
彼得·
答
code是如下:
Intent powerUsageIntent = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY);
ResolveInfo resolveInfo = getPackageManager().resolveActivity(powerUsageIntent, 0);
// check that the Battery app exists on this device
if(resolveInfo != null){
startActivity(powerUsageIntent);
}