我想知道如何以意图打开手机设置应用程序的活动。我想用一个按钮来操作电池统计活动。 谢谢!
答案 0 :(得分:0)
是的,谢谢!
btnCheckBattery = (Button)findViewById(R.id.checkBattery);
intentBatteryUsage = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY);
ResolveInfo resolveInfo = getPackageManager().resolveActivity(intentBatteryUsage,0);
if(resolveInfo == null){
Toast.makeText(AndroidIntentBatteryUsageActivity.this,
"Not Support!",
Toast.LENGTH_LONG).show();
btnCheckBattery.setEnabled(false);
}else{
btnCheckBattery.setEnabled(true);
}
btnCheckBattery.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
startActivity(intentBatteryUsage);
}});