创建和QUOT;电池使用"意图安卓 [英] Create "Battery usage" intent android

查看:174
本文介绍了创建和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);
}

这篇关于创建和QUOT;电池使用"意图安卓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆