/** * Copyright (c) 2013 Nokia Corporation. All rights reserved. * Nokia and Nokia Connecting People are registered trademarks of Nokia Corporation. * Oracle and Java are trademarks or registered trademarks of Oracle and/or its * affiliates. Other product and company names mentioned herein may be trademarks * or trade names of their respective owners. * See LICENSE.TXT for license information. */ package com.nokia.example.imagescaler; import javax.microedition.lcdui.Alert; import javax.microedition.lcdui.Display; import javax.microedition.midlet.MIDlet; /** * The application main class. */ public class Main extends MIDlet { private MainView mainView; private final boolean isAPIAvailable; /** * Constructor. */ public Main() { // Checks whether the FileSelect API is available or not isAPIAvailable = System.getProperty("microedition.io.file.FileConnection.version") != null; } /** * @see javax.microedition.midlet.MIDlet#startApp() */ public void startApp() { if (isAPIAvailable) { mainView = new MainView("Image Scaler Example", this); Display.getDisplay(this).setCurrent(mainView); } else { String text = getAppProperty("MIDlet-Name") + "\n" + getAppProperty("MIDlet-Vendor") + "\nFile Connection API is not available!"; Alert alert = new Alert(text); Display.getDisplay(this).setCurrent(alert); } } /** * @see javax.microedition.midlet.MIDlet#pauseApp() */ public void pauseApp() { } /** * @see javax.microedition.midlet.MIDlet#destroyApp(boolean) */ public void destroyApp(boolean unconditional) { } /** * Quits the application. */ public void quit() { destroyApp(true); notifyDestroyed(); } }