Jump to content

ningantai

Members
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

1 Neutral
  1. Thanks to Dave Nottage, The code you provided works perfectly.
  2. Following are Java's Reflection APIs to retreive the value returned by getBatteryCapacity method of com.android.internal.os.PowerProfile : Can anyone convert this to Delphi 12 syntax? public double getBatteryCapacity(Context context) { Object mPowerProfile; double batteryCapacity = 0; final String POWER_PROFILE_CLASS = "com.android.internal.os.PowerProfile"; try { mPowerProfile = Class.forName(POWER_PROFILE_CLASS) .getConstructor(Context.class) .newInstance(context); batteryCapacity = (double) Class .forName(POWER_PROFILE_CLASS) .getMethod("getBatteryCapacity") .invoke(mPowerProfile); } catch (Exception e) { e.printStackTrace(); } return batteryCapacity; }
×