j2me code for blackberry application to display battery level
How can I make a Blackberry applica开发者_开发百科tion display the battery level using J2ME?
if you're developing a native cldc blackberry app i'd rather use
net.rim.device.api.system.DeviceInfo.getBatteryLevel();
if you're developing MIDlet the only chance is to use the mobile sensor api.
You also can have it display in the titlebar if you are making an app for newer devices
StandardTitleBar TitleBar = new StandardTitleBar()
//.addIcon("my_logo.png")
.addTitle("App title")
.addNotifications()
.addNotifications()
.addSignalIndicator();
TitleBar.setPropertyValue(StandardTitleBar.PROPERTY_BATTERY_VISIBILITY,
StandardTitleBar.BATTERY_VISIBLE_ALWAYS);
setTitleBar(TitleBar);
PS, its also very nice for you to mark something as answered.
精彩评论