0% found this document useful (0 votes)
15 views5 pages

BIT4107

BIT4107
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views5 pages

BIT4107

BIT4107
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 5

BIT4107 MOBILE APPLICATION DEVELOPMENT

ASSIGNMENT 1 (15 MARKS)

• Write a simple MIDlet application to display your name and Registration number
on the screen (3 marks)

import javax.microedition.midlet.*;

import javax.microedition.lcdui.*;

public class MyMIDlet extends MIDlet implements CommandListener {

private Display display;

private Form form;

private Command exitCommand;

public MyMIDlet() {

display = Display.getDisplay(this);

form = new Form("My MIDlet");

exitCommand = new Command("Exit", Command.EXIT, 1);

form.addCommand(exitCommand);

form.setCommandListener(this);

StringItem nameItem = new StringItem("Name: ", "Dancan Yego");

StringItem regNumItem = new StringItem("Registration Number: ", "BIT/2020/63702");

form.append(nameItem);

form.append(regNumItem);
}

public void startApp() {

display.setCurrent(form);

public void pauseApp() {

public void destroyApp(boolean unconditional) {

public void commandAction(Command c, Displayable d) {

if (c == exitCommand) {

notifyDestroyed();

• Explain into details how the following technologies work (6 marks)

• 2Gnetworks

- Second generation (2g) telephone technology is based on GSM or in other words global
system that has enabled the various mobile phone networks to provide the services such as
text messages, picture messages and MMS (multimedia messages) for mobile communication.

- 2Gnetworka are either time division multiple access (TDMA) or code division multiple
access (CDMA). TDMA allows for the division of signal into time slots.

• 3G networks

- 3G technologies make use of TDMA and CDMA. 3G (Thrid Generation Technology)


technologies make use of value added services like mobile television, GPS (global positioning
system) and video conferencing.

- The basic feature of 3G Technology (Thrid Generation Technology) is fast data transfer
rates.dw

• 4G networks

- 4Gnetwork technology uses WiMAX and LTE . LTE technology, are based on a packet-
switching system, which is more efficient than the circuit-switching used in 2G. This allows
for better handling of data traffic.

- It provides high data transmission speed and is suitable for HD video calling, fast download
and upload, live streaming, online gaming, etc. A 4G system must adhere to the capabilities
and features specified by the ITU(International Telecommunication Union) in IMT advanced,
including transmission technology and data speed. 4G network provides up to 100 Mbps
speed to users, far higher than a 3G network.

• Write a simple syntax for read record method of MIDlet Application.(3 marks)

import javax.microedition.midlet.*;

import java.io.*;

public class MyMIDlet extends MIDlet {

private ByteArrayInputStream strmBytes;


private DataInputStream strmDataType;

private String dataString;

private int dataInt;

public MyMIDlet() {

// Initialize strmBytes and strmDataType with the record data (rec1)

strmBytes = new ByteArrayInputStream(rec1);

strmDataType = new DataInputStream(strmBytes);

public void readRecord() throws IOException {

dataString = strmDataType.readUTF(); // Read a string

dataInt = strmDataType.readInt(); // Read an integer

// dataString and dataInt hold the read values

• Write a simple code in MIDlet application to open and establish an HTTP


connection (3 marks)

import javax.microedition.midlet.*;

import javax.microedition.io.*;

import java.io.*;
public class MyMIDlet extends MIDlet {

private HttpConnection httpConnection;

private InputStream inputStream;

public void establishHTTPConnection() throws IOException {

String url = "http://tmart.co.ke";

httpConnection = (HttpConnection) Connector.open(url);

httpConnection.setRequestMethod(HttpConnection.GET);

// Check the HTTP response code

int responseCode = httpConnection.getResponseCode();

if (responseCode == HttpConnection.HTTP_OK) {

inputStream = httpConnection.openInputStream();

// inputStream reads data from the server

} else {

println("Invalid connection ")

You might also like