Please help new to Java

I am trying to use either Netbeans or Wireless Toolkit WITH a Motorola SDK for my i415 Motorola Cell phone. I have Netbeans installed, WTK 2.5.1 installed, and the SDK from Motorola. I have gotten WTK working and downloaded simple Helloworld java to my phone successfully.

I want to use a class in the Motorola SDK called "StatusManager.class" It will get me the battery level, signal streght, and some other system things. I need to know how to use this with a simple midlet. IE; where to put the StatusManager.class file or call it? I am lost here. At least if someone would be nice enough to point me in the right direction, maybe I can figure it out...

Thanks

[682 byte] By [k711a] at [2007-11-27 8:41:45]
# 1
it depends if this class needs other class from the MOTOW sdk...best way is to add the MOTOW package in your MIDlet suite...
suparenoa at 2007-7-12 20:40:51 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2
> best way is to add the MOTOW package in your MIDlet> suite... How do I do that?
k711a at 2007-7-12 20:40:51 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3
> > best way is to add the MOTOW package in your> MIDlet> > suite...> How do I do that?properties / libraries & resources / add jar/zip
suparenoa at 2007-7-12 20:40:51 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4

Ok, I see this in Netbeans (properties / libraries & resources / add jar/zip). But I can't find too many .JAR files in the MOTO iden SDK directories. There are LOTS of .CLASS files tho. I am still lost. I see in device/i730/Emulator.jar & DebugAgent.jar.... And in bin/ Cofig.jar, default.jar, projectManager.jar Should I be finding StatusManager.jar somewhere instead of StausManager.class?

k711a at 2007-7-12 20:40:51 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 5

sorry i don't use Netbeans with MOTO sdk (in fact i'm using eclipse with eclipseme...)

i think that status class is in the midp or cldc jar from MOTO so you have to import it (or them)

and compile these jar (and without sun midp or cldc jar)

if you are always blocked, try this:

To subscribe to the list, send a message to:

<nbusers-subscribe@netbeans.org>

suparenoa at 2007-7-12 20:40:51 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 6

Hi

Ok, I think I might be getting closer.

I gave up on Netbeans & WTK and just using MOTO iden SDK to build the Midlet.

I found that things like "Alert" and Textbox" "Form" are in directorys and are CLASS files. That make sense? So, I found that the StatusManager class is in

"import com.mot.iden.device.*;"

I get one error when I try to build the Midlet. I just don't think my syntax is correct, or the way I am writing the code. I am sure this is simple, but I am new to all this.

Here's my simple JAVA:

/*

/*

* Battery.java

*

* Created on June 18, 2007, 10:37 AM

*/

import javax.microedition.midlet.*;

import javax.microedition.lcdui.*;

import com.mot.iden.device.*;

/**

*

* @author gko

* @version

*/

public class Battery extends MIDlet {

public void startApp() {

Object batt;

batt = getStatus(int BATTERY_LEVEL);

}

public void pauseApp() {

}

public void destroyApp(boolean unconditional) {

}

}

And the error when I build is:

C:\0-idenjdk-0\rsc\Battery.java:19: cannot find symbol

symbol : variable BATTERY_LEVEL

location: class Battery

batt = getStatus(BATTERY_LEVEL);

^

1 error

Building over

Can you see the problem here?

Do I need to setup a variable?

k711a at 2007-7-12 20:40:51 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 7

FROM MOTO DOCS INCLUDED WITH SDK:

Method Detail

getStatus

public static int getStatus(int item)

throws java.lang.IllegalArgumentException

Retrieves the status of the requested Item

See the following possible Paramaters:

BATTERY_LEVEL

SIGNAL_STRENTH

CALL_FORWARD_STATE

CURRENT_ACTIVE_LINE

NUM_UNREAD_TEXT_MSG

NUM_TEXT_MSG

NUM_UNHEARD_VOICE_MAIL

NUM_VOICE_MAIL

NUM_UNREAD_NET_ALERT

NUMD_NET_ALERT

HIGH_AUDIO_STATE

CURRENT_VIBE_STYLE_LINE1

CURRENT_VIBE_STYLE_LINE2

CURRENT_VIBE_STYLE_ALERT

Parameters:

item - Which item to get the status for.

Returns:

the status of the item requested.

java.lang.IllegalArgumentException

k711a at 2007-7-12 20:40:51 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 8

FROM MOTO DOCS INCLUDED WITH SDK:

Field Detail

BATTERY_LEVEL

public static final int BATTERY_LEVEL

This is the value passed to the status manager to retrive the battery levels

The return value is in the range of [0 - 3] with 0 being no charge and 3 being a full battery.

BATTERY_LEVEL has a value of 0

k711a at 2007-7-12 20:40:51 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 9

Hi k711

I'm also new, but can I try to help?

Try changing your code to

===================

int batt;

batt = StatusManager.getStatus(0);

===================

OR

===================

int batt;

batt = StatusManager.getStatus(StatusManager.BATTERY_LEVEL);

===================

Do let me know if this works, I also have a Motorola and am downloading the SDK right now.

Regards, Darryl

Darryl.Burkea at 2007-7-12 20:40:51 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 10
Darryl,Hi , i sent you an email to your address shown on your website.Thanks!
k711a at 2007-7-12 20:40:51 > top of Java-index,Java Mobility Forums,Java ME Technologies...