-1
// Are we charging/charged?
int status = batteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
//Determine the Current Battery Level
int level = batteryStatus.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
int scale = batteryStatus.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
裁判:http://developer.android.com/training/monitoring-device-state/battery-monitoring.html這段代碼中-1的意義或用法是什麼?
如果找不到狀態,它可能是應該返回的默認值 – John
@John:的確是缺省值。 [見'getIntExtra' here](http://developer.android.com/reference/android/content/Intent.html) – Amadan
回答你的問題.. – John