I am using below code and its working properly with compileSdkVersion 22
int capacityValue=new BatteryManager().getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY);
but when trying to change compileSdkVersion 23
then its displaying compile time error
Error:(172, 25) error: BatteryManager() is not public in BatteryManager; cannot be accessed from outside package android
plz help me.