RecordStore: deleteRecordStore(String value) throws RecordStoreException, RecordStoreNotFoundException : RecordStore « javax.microedition.rms « Java by API






RecordStore: deleteRecordStore(String value) throws RecordStoreException, RecordStoreNotFoundException

 

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.TextBox;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
import javax.microedition.rms.RecordStore;

public class deleteRecordStoreMIDlet extends MIDlet implements CommandListener {
  private Command exitCommand;

  private Command confirmCommand;

  private Display display;

  public deleteRecordStoreMIDlet() {
    display = Display.getDisplay(this);
    exitCommand = new Command("exit", Command.EXIT, 1);
    confirmCommand = new Command("confirm", Command.OK, 1);
  }

  public void startApp() {
    TextBox aTextBox = new TextBox("RecordStore", null, 256, TextField.ANY);

    aTextBox.addCommand(exitCommand);
    aTextBox.addCommand(confirmCommand);
    aTextBox.setCommandListener(this);
    display.setCurrent(aTextBox);
  }

  public void pauseApp() {
  }

  public void destroyApp(boolean unconditional) {
  }

  public void commandAction(Command c, Displayable s) {
    if (c.getCommandType() == Command.EXIT) {
      destroyApp(false);
      notifyDestroyed();
    } else {
      try {
        RecordStore.deleteRecordStore("aRS");
      } catch (Exception e) {
      }
    }
  }
}

   
  








Related examples in the same category

1.RecordStore: enumerateRecords(RecordFilter filter, RecordComparator comparator, boolean keepUpdated) throws RecordStoreNotOpenException
2.RecordStore: getNumRecords() throws RecordStoreNotOpenException
3.RecordStore: getRecord(int arg0, byte[] arg1, int arg2) throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException
4.RecordStore: getRecordSize(int value) throws RecordStoreNotOpenException, InvalidRecordIDException, RecordStoreException
5.RecordStore: listRecordStores()
6.RecordStore: openRecordStore(String value, boolean arg1) throws RecordStoreException, RecordStoreFullException, RecordStoreNotFoundException