启动设置电池统计数据 activity
Launch setting battery stats activity
我想知道如何打开带有意图的 phone 设置应用程序的 activity。我想用一个按钮打开电池统计数据 activity。
谢谢!
好的,谢谢!
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);
}});
我想知道如何打开带有意图的 phone 设置应用程序的 activity。我想用一个按钮打开电池统计数据 activity。 谢谢!
好的,谢谢!
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);
}});