Introduction




Name of Experiment: Display Battery Level of NOKIA ASHA 501

Exp No: 2

Background: Student should have a basic knowledge of Java Programming.

Summary: After going through this experiment, student should be able to display battery level on Nokia Asha 501 device.

Learning Objective: Here, Student should learn the procedure to display battery level on nokia Asha Device . After, doing this experiment user himself will be able to make an app to display battery level on nokia Asha Device.

Target

Target Platform:This experiment is tested on Nokia Asha Device 501.

Procedure

SourceCode

Source Code:

package batterylevel;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class Batterylevel extends MIDlet {
Form form;
String sname,battery;
public Batterylevel() {
// TODO Auto-generated constructor stub
form =new Form("Battery Level");
//sname=new String("By IGDTUW");
battery=System.getProperty("com.nokia.mid.batterylevel");
//form.append(sname);
form.append("Battery Level="+battery);
form.append("\n"+"By:Nicy Kaur Taneja");
form.append("\n"+"Vandana Kumari");}
protected void destroyApp(boolean unconditional)
throws MIDletStateChangeException {// TODO Auto-generated method stub}
protected void pauseApp() {// TODO Auto-generated method stub}
protected void startApp() throws MIDletStateChangeException {// TODO Auto-generated method stub
Display.getDisplay(this).setCurrent(form); }}

Snapshots



This is how the output appears on the emulator of NOKIA Asha SDK 1.0 on successful compilation of source code.

Observation

Observation: Students have successfully displayed the battery level of NOKIA Asha 501 device.

Video Link

Download