Java Reference
In-Depth Information
} void loadSearch() {
Store store = getStore();
String tags = store.has(STORE_TAGS)
? String(store.getValue(STORE_TAGS)) : "";
String tagmode = store.has(STORE_TAGMODE)
? String(store.getValue(STORE_TAGMODE)) : "0";
int i = int(tagmode);
A Store is a hashmap-like structure, in the sense that it holds
key-value pairs, where the key is an Object and the value is a Value
object (see API documentation for more details on these classes). The
main difference between a Store and a normal Java Hashtable is that
a Store is persistent, that is, data contained on it can be used across
several Flickr Viewer runs. It can be thought of as WidSets version
of MIDP's record management system (RMS) persistence scheme. The
saveSearch() method gets a reference to the default store and adds a
couple of name-value pairs, where the value is retrieved from the form
fields. loadSearch() behaves similarly, loading values from the default
store and filling in the form fields with information saved previously.
Next, let's look at the core functionality of your application: down-
loading a photo feed from Flickr, filtered by the search criteria, and
displaying the scaled pictures to the user. Going back once again to
actionPerformed() , let's see how this operation is performed:
// Action handler is called for widget whenever an event is fired,
// such as menu-item-select, a softkey is clicked, an item is focused,
// or item contents are changed
void actionPerformed(final Shell shell, final Component source,
final int action)
// omitted code
else if(action == CMD_SEARCH) {
} // omitted code
When users click on the Search menu item, we display a Prompt to
inform them that the search has begun and is going to take some time.
A Prompt is similar to the LCDUI's Alert class: it's a quick way of
displaying short information without having to construct an entire new
view. After displaying the prompt, we call the fetch() method, which
performs the actual job:
Search WWH ::

Custom Search