Persistent Storage
Almost all MIDlets need to be able to save information so that it is retained between invocations. Examples of the types of information that might need to be stored include the following:
Data entered by the user, such as text typed into a memo pad application.
User configuration or preference information. For a mail application, this might be the name of the mail server to which outgoing mail should be sent or how frequently to poll for new incoming mail.
Values that the user recently entered or uses frequently. For an application that accesses the Internet, for example, it would be helpful to keep a history of recently used URLs that the user can use as a shortcut list.
A J2SE application typically stores state in local files that are quickly and easily accessible from the hard drive or transparently accessible over a fast local area network. Mobile devices, however, do not have local disks and rarely have network connectivity that is permanently available or fast enough to support storage of frequently used information at a remote location. The MIDP specification requires all implementations to provide a persistent storage facility so that information can be preserved while a MIDlet is not running or when the device is turned off. In practice, the actual storage mechanism may vary from device to device, but the programming interface does not, which makes MIDlets that use this facility more portable than if they had been required to be aware of the device-dependent ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access