import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;
public class MemoryInformation extends MIDlet implements CommandListener {
private Display display;
private Form form;
private Command exitCommand;
public void startApp() {
display = Display.getDisplay(this);
form = new Form("");
exitCommand = new Command("Exit", Command.EXIT, 0);
form.addCommand(exitCommand);
form.setCommandListener(this);
Runtime rtime = Runtime.getRuntime();
form.append("Total memory: " + rtime.totalMemory());
form.append("Free memory: " + rtime.freeMemory());
System.out.println("Total memory: " + rtime.totalMemory());
System.out.println("Free memory: " + rtime.freeMemory());
display.setCurrent(form);
}
protected void pauseApp() {
}
protected void destroyApp(boolean arg0) {
}
public void commandAction(Command c, Displayable s) {
if (c == exitCommand) {
destroyApp(true);
notifyDestroyed();
}
}
}
No comments:
Post a Comment