--Your friends at LectureNotes

Lab Manuals for Mobile Application Development - MAD By ANNA SUPERKINGS

  • Mobile Application Development - MAD
  • Practical
  • Information Technology Engineering
  • 8 Offline Downloads
  • Uploaded 1 year ago
Anna Superkings
Anna Superkings
0 User(s)
Download PDFOrder Printed Copy

Share it with your friends

Leave your Comments

Text from page-1


Text from page-2

Objective: In this lab, a student is expected to design, implement, document and present a mobile client/server system using standard Java and Java 2 Micro Edition (J2ME) platform. Specifically it is required to design and implement a system that consists mainly of a mobile client (MC) and a Proxy Server (PS). MC will be written in J2ME, MIDP 2.0, while PS will be written in standard Java. It is necessary to use a mobile phone emulator to develop and demonstrate the experiments. It may be necessary to use other components or existing resources (servers) as needed. For instance a database local to PS or a web service available on the Internet that can be invoked by the PS. Week - 1: Installation of Java Wireless Toolkit (J2ME) 1) If the Java Development Kit (JDK) is not theory only having the Java Runtime Environment (JRE) installed, install the latest JDK from http://java.sun.com/javase/downloads/index.jsp. Current stable release of Java is JDK 6 Update 7 but check the web page in case there are newer non-beta releases available. 2) Next, download the Java Wireless Toolkit (formerly called J2ME Wireless Toolkit) from: http://java.sun.com/products/sjwtoolkit/download.html. 3) Run the installer (for example, for Windows it is: sun_java_wireless_toolkit- 2_5_2windows.exe). The installer checks whether a compatible Java environment has been preinstalled. If not, it is necessary to uninstall old versions of Java and perform Step 1 again. Once after successful installation of Java and the tool kit compile this program and run the following program in the toolkit. Steps to run this program in toolkit: Start -> All Programs -> Sun Java Tool Kit -> Wireless Tool Kit Click New Project – Enter Project Name -> Enter Class Name -> Click on Create Project. Choose appropriate API Selection and Configurations. Place Java Source file in WTK2.1 / WTK2.2\apps\projectname\src Build the Project. Run the Project. import javax.microedition.lcdui.*; import javax.microedition.midlet.*; public class HelloWorld extends MIDlet{ private Form form; private Display display; public HelloWorld(){ super(); } public void startApp(){ form = new Form("Hello World"); String msg = "Hello World!!!!!!!"; form.append(msg); display = Display.getDisplay(this); display.setCurrent(form);

Text from page-3

} public void pauseApp(){} public void destroyApp(boolean unconditional){ notifyDestroyed(); } } Week - 2 Working with J2ME Features: Working with J2ME Features: Say, creating a Hello World program Experiment with the most basic features and mobile application interaction concepts (lists, text boxes, buttons, radio boxes, soft buttons, graphics, etc) 2.1 Create a program which creates to following kind of menu. * cut * copy * past * delete * select all * unselect all Program: Source code: import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class MenuCreation extends MIDlet implements CommandListener { public ChoiceGroup ch; public Form form; public Display display; public Command command; public StringItem st; public MenuCreation() { display=Display.getDisplay(this);

Text from page-4

ch=new ChoiceGroup("Edit",Choice.EXCLUSIVE); ch.append("cut",null); ch.append("copy",null); ch.append("paste",null); ch.append("delete",null); ch.append("select all",null); ch.append("unselect all",null); ch.setSelectedIndex(1, true); command=new Command("Select list item",Command.OK,1); form=new Form(""); form.append(ch); form.addCommand(command); form.setCommandListener(this); st=new StringItem("",""); } public void startApp() { display.setCurrent(form); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } public void commandAction(Command command,Displayable displayable) { if(command==command) { st.setText(""); st.setText("your selected option is "+ch.getString(ch.getSelectedIndex())); form.append(st); } } } Output:

Lecture Notes