الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

Memory Status

بدأه .S.T.A.L.K.E.R في 1 مارس 2008 · 1 رد · 899 مشاهدة · في JavaME
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

to know memory status this code works


import javax.microedition.lcdui.*;

/**
* @author Mohammed Ersan
*/
public class Main extends MIDlet implements CommandListener {

Display display;
Form form1;
Command exitcmd, refreshcmd;

public Main() {

exitcmd = new Command("Exit", Command.BACK, 1);
refreshcmd = new Command("Refresh", Command.OK, 0);

display = Display.getDisplay(this);
form1 = new Form("Memory Status");
form1.addCommand(refreshcmd);
form1.addCommand(exitcmd);
form1.setCommandListener(this);

display.setCurrent(form1);

}

public void startApp() {
}

public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
}

public void commandAction(Command c, Displayable d) {
if (c == exitcmd) {
notifyDestroyed();
}

if (c == refreshcmd) {
form1.deleteAll();
printMemoryStatistics();
}

}

public void printMemoryStatistics() {

Runtime rt = Runtime.getRuntime();

form1.append("***MemoryStatistics***\n");
form1.append("FreeMemory=" + rt.freeMemory() + "\n");
form1.append("Used Memory=" + (rt.totalMemory() - rt.freeMemory()) + "\n");
form1.append("Total Memory=" + rt.totalMemory() + "\n");
form1.append("******************");



}
}
import javax.microedition.midlet.*;

#2

مشكور وجاري التجريبه

banner1.gif

مواضيع مشابهة