BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-10-2009, 10:34 PM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: May 2008
Model: 9700
OS: 5.0.0.330
PIN: 217FEEC9
Carrier: T-Mobile
Posts: 31
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Quick Newbie Question

Please Login to Remove!

This program is basically the HelloWorld application and I'm trying to retrieve the battery level by way of getBatteryLevel() to bnum. I'm pretty unaware of why I get the "Cannot find symbol area" seeing as I imported the needed classes supposedly and it only returns a int, but here it goes:

Code:
/*
 * InfoProgram.java
 *
 *  <your company here>, 2003-2005
 * Confidential and proprietary.
 */

package src;

import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.system.RadioInfo.*;
import net.rim.device.api.system.DeviceInfo;



/**
 * 
 */
class InfoProgram extends UiApplication
 {
    public static void main(String[] args)
    {
        InfoProgram App = new InfoProgram();
        App.enterEventDispatcher();
    }
    
    public InfoProgram()
    {
        pushScreen(new InfoProgramScreen());
    }
}

final class InfoProgramScreen extends MainScreen
{
        public InfoProgramScreen()
    {
        super();
        LabelField title = new LabelField("InfoProgram", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
        setTitle(title);

        int bnum = getBatteryLevel();
        add(new RichTextField("Battery Level: "+bnum));
    }
    
    public boolean onClose()
    {
        Dialog.alert("Goodbye!");
        System.exit(0);
        return true;
    }
}
Offline  
Old 07-10-2009, 11:50 PM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

getBatteryLevel() is a method of DeviceInfo, not MainScreen.

The code should be:

int bnum = DeviceInfo.getBatteryLevel()
Offline  
Old 07-10-2009, 11:59 PM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: May 2008
Model: 9700
OS: 5.0.0.330
PIN: 217FEEC9
Carrier: T-Mobile
Posts: 31
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Dougsg38p View Post
getBatteryLevel() is a method of DeviceInfo, not MainScreen.

The code should be:

int bnum = DeviceInfo.getBatteryLevel()
Thanks, was sorta wracking my brain over trying to fix it..
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

White LCD Display+Touch Screen Digitizer Assembly Replacement for iPhone 5S OEM
$13.99
White LCD Display+Touch Screen Digitizer Assembly Replacement for iPhone 5S OEM pictureLot of 3 Wiped Seagate 750GB 7200 RPM 3.5" ST3750640NS OEM Apple Hard Drives
$89.99
Lot of 3 Wiped Seagate 750GB 7200 RPM 3.5Seagate 750GB 7200 RPM 3.5" ST3750640NS OEM Apple Hard Drive Wiped
$35.99
Seagate 750GB 7200 RPM 3.5CC8: Genuine OEM Apple Mac LONG DVI to VGA Video Adapter Cable 603-2120/591-011
$9.34
CC8:  Genuine OEM Apple Mac LONG DVI to VGA Video Adapter Cable 603-2120/591-011 pictureOEM Part HARD Drive assembly 250mb SCSI Oerlikon 901-416 APPLE iTRADE-AG with c
$137.5
OEM Part HARD Drive  assembly 250mb SCSI Oerlikon 901-416 APPLE iTRADE-AG with c picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.