import javax.microedition.midlet.*; import javax.microedition.rms.*; import javax.microedition.lcdui.*; public class Salvestus1 extends MIDlet{ String hoidlanimi="hoidla1"; protected void startApp() throws MIDletStateChangeException{ try{ RecordStore rs=RecordStore.openRecordStore(hoidlanimi, true); byte arv=1; if(rs.getNumRecords()==0){ rs.addRecord(new byte[]{(byte)(arv+1)}, 0, 1); } else { arv=rs.getRecord(1)[0]; rs.setRecord(1, new byte[]{(byte)(arv+1)}, 0, 1); } Alert a=new Alert("Loendur", arv+". kord", null, AlertType.CONFIRMATION); a.setTimeout(Alert.FOREVER); Display.getDisplay(this).setCurrent(a); }catch(Exception e){e.printStackTrace();} } protected void pauseApp(){} protected void destroyApp(boolean kohustus) throws MIDletStateChangeException{} }