I have experienced an intermittent MIDlet crash that seems very hard to understand.
I have tested the code below on a Nokia 6630. Repeat runs of entering three or four character strings in the two fields alternating with clearing one of the fields (so the alert is shown) will eventually result in the midlet quitting without showing any exception alert.
It does not appear to occur on other series 60 devices (such as a 6600).
Does anyone have any similar experience or know of any work-around?
Code:public final class CrashForm extends Form implements CommandListener { private final TextField m_name = new TextField("Name", "", 50, TextField.ANY); private final TextField m_url = new TextField("Tag", "", 255, TextField.ANY); public CrashForm() { super("Test"); setCommandListener(this); super.addCommand(new Command("Save", Command.OK, 1)); super.append(m_name); m_url.setLayout(Item.LAYOUT_NEWLINE_BEFORE); super.append(m_url); } private void save() { final String name = m_name.getString(); final String url = m_url.getString(); if(name.length() > 0 && url.length() > 0) { m_name.setString(null); m_url.setString(null); } else { final Alert alert = new Alert("Invalid details", "Please try again", null, AlertType.INFO); Display.getDisplay(s_instance).setCurrent(alert, this); } } public void commandAction(final Command command, final Displayable displayable) { save(); } }

Reply With Quote

