Know your Mobile – A simple j2me application

This is a very simple code of j2me. By implementing it, and running it by your mobile device, you could learn some attributes of Java configuration of your mobile device.

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class AttributesMIDlet extends MIDlet{
private Display display;
private Command cExit;

public void startApp(){
display = Display.getDisplay(this);

cExit = new Command(“Quit”, Command.EXIT, 0);

Canvas canvas = new DummyCanvas();

Runtime runtime = Runtime.getRuntime();
Form form = new Form(“Attributes”);

form.append(new StringItem(“Know Your Mobile”, “”));
form.append(new StringItem(“Total Memory:”, String.valueOf(runtime.totalMemory()/1024)+”Kb”));
form.append(new StringItem(“Free Memory:”, String.valueOf(runtime.freeMemory()/1024)+”Kb”));
form.append(new StringItem(“n”, null));
form.append(System.getProperty(“microedition.configuration”));
form.append(System.getProperty(“microedition.profiles”));

boolean isColor = display.isColor();

form.append(new StringItem(isColor ? “Colors:”: “Grays:”, String.valueOf(display.numColors())));
form.append(new StringItem(“Width: “, String.valueOf(canvas.getWidth())));
form.append(new StringItem(“Height:”, String.valueOf(canvas.getHeight())));
form.append(new StringItem(“Repeat:”, String.valueOf(canvas.hasRepeatEvents())));
form.append(new StringItem(“Double Buff:”, String.valueOf(canvas.isDoubleBuffered())));

form.addCommand(cExit);
form.setCommandListener(
new CommandListener(){
public void commandAction(Command c, Displayable d){
if (c == cExit){
destroyApp(false);
notifyDestroyed();
}
}
}
);

display.setCurrent(form);
}
public void pauseApp(){
}
public void destroyApp(boolean unconditional){
}
}

class DummyCanvas extends Canvas{
public void paint(Graphics g){
;
}
}

Posted in J2ME. Tags: , . 6 Comments »

6 Responses to “Know your Mobile – A simple j2me application”

  1. abirami Says:

    please send me some peer to peer network related j2me programs

  2. mahipal Says:

    Hi,
    I want to leran J2ME so if it is possible the send me this application with the out put and the .jar file for mobile device all so

  3. preeti Says:

    pls send me simple j2me app

  4. surya Says:

    please send me a client server program for j2me

  5. seeyou Says:

    Pls I need help with developing a mobile phone dictionary. Send me anything you got relating it, no matter how little it may be.

  6. Terra Says:

    “Know your Mobile – A simple j2me application | Think Different” was in fact a great post.
    If perhaps it owned even more photographs this
    would definitely be even far better. Regards ,Terra


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: