Google

Friday, January 2, 2009

Full Screen Mode

Full screen mode is now possible with:

public void startApp() {
if (canvas == null) {
canvas = new practiceCanvas(Display.getDisplay(this));
Command exitCommand = new Command("Exit", Command.EXIT, 0);
canvas.addCommand(exitCommand);
canvas.setFullScreenMode(true);
canvas.setCommandListener(this);
}

// Start up the canvas
canvas.start();
}


However, the older deprecated Nokia UI is available for
download here:

Nokia UI, API

But it is not necessary. Previously to get full screen,
you need to do this:

import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;
import java.util.*;
import java.io.*;
import com.nokia.mid.ui.*;

public class practiceCanvas extends FullCanvas implements Runnable{


Now, with MIDP2, no need to extend Nokia's FullCanvas class,
to get fullscreen just set:

canvas.setFullScreenMode(true);

This works for SonyEricsson as well as Nokia.
However, in Nokia, you may need to press keypad 5 for
the fire button, instead of the usual controller center
key

Device Control

However it is a good idea to take a look at the
deprecated Nokia UI to see what device control is available
as replaced by MIDP2, eg,

com.nokia.mid.ui Class DeviceControl

enables vibration, etc...

display.vibrate(int frequency)
frequency is from 1 to 100

Others:

javax.microedition.lcdui.Display.flashBacklight(int).

However, note that when you do:

AlertType.INFO.playSound(display);

the mobile phone may also vibrate. As such it
may be redundant to call display.vibrate();

Note that other S40_6th_Edition_SDK contains other
API specific to Nokia only. If you choose to implement them,
then the program is limited to Nokia.