Разработка мобильных приложений. Соколова В.В. - 94 стр.

UptoLike

Составители: 

94
}
}
}
else {
// Go to the Favotites
display.setCurrent(favoriteList);
}
}
});
}
private void createFavoriteList() {
// Create the list
favoriteList = new List("Favorites", List.IMPLICIT);
// Set the select command
favoriteList.setSelectCommand(playCommand);
// Set other commands
favoriteList.addCommand(deleteCommand);
favoriteList.addCommand(gotoMenuCommand);
favoriteList.setCommandListener(new CommandListen-
er() {
public void commandAction(Command c, Displayable
d) {
if (c == playCommand) {
// Show an alert for 5 seconds
int index = favoriteL-
ist.getSelectedIndex();
String item = favoriteL-
ist.getString(index);
Alert alert = new Alert("Playing...",
item, null, AlertType.INFO);
alert.setTimeout(5000);
display.setCurrent(alert, favoriteList);
}
else if (c == deleteCommand) {
// Remove the item from this list and add it to Store
int index = favoriteL-
ist.getSelectedIndex();
String item = favoriteL-
ist.getString(index);
favoriteList.delete(index);
storeList.append(item, null);
}
else {
display.setCurrent(menuList);
}
}
});
}