开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜