Hi:- I am developing a mobile application for my Nokia 6600...Using JBuilder 2005 (Wireless Toolkit 2.0)...MIDP 2.0 and CDLC 1.0....the problem is that I have made a splash screen for my application using Canvas..and from there user have to press a softkey for start of Application and other for Exit...The problem is that...the MIDlet is runnig wuite well on JBuilder Emulator...and when I press the soft keys its respond properly..but when I installed that application to my Nokia 6600...then Only the Splash screen is displayed and commands are shown on the screeen but when I press the soft keys no action is performed...i.e. Mobile doesn't show any response....some Important parts of my code are as follows...
/***************Main MIDLET*/////////////
public class HomeSecurityMIDlet extends MIDlet implements CommandListener {
static HomeSecurityMIDlet instance;
private SplashScreen splash_start;
private Display main_display = Display.getDisplay(this);
static final Command ExitCommand = new Command("Exit", Command.EXIT, 1);
static final Command StartCommand = new Command("Start",Command.OK,0);/*More smaller the number more thr priority*/
UserControl displayable = new UserControl(this);
public HomeSecurityMIDlet() {
instance = this;
try{
splash_start = new SplashScreen("Muhammad Ummar Iqbal",
"Tasawar Gulzar", "Abid Islam");
/*Initializing the Splash Screen*/
splash_start.addCommand(ExitCommand);
splash_start.addCommand(StartCommand);
splash_start.setCommandListener(this);
}catch (Exception exp)
{
System.err.println("Problem loading image "+exp);
}
}
public void startApp() {
this.Show_Splash();/*Displays the Splash Screen*/
//main_display.setCurrent(displayable);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public static void quitApp() {
instance.destroyApp(true);
instance.notifyDestroyed();
instance = null;
}
public void Show_Splash(){
main_display.setCurrent(splash_start);
}
public void commandAction(Command c, Displayable s)
{
if (c.getCommandType( ) == Command.EXIT)
{
destroyApp(true);
notifyDestroyed( );
}
if(c.getCommandType() == Command.OK)/*If Ok Button is pressed*/
{
splash_start.move_banner_thread = null;/*Stop the Moving Names Thread*/
main_display.setCurrent(displayable);
}
}
}
/*******************************************************/
/*********************Splash screen Class*****************/
public class SplashScreen extends Canvas implements Runnable {
public SplashScreen() {
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public Thread move_banner_thread = new Thread(this);/*Moving Names Thread*/
private String mem1,mem2,mem3 ;/*Variable to store the names of Group Members*/
private String combined_mem;
public SplashScreen(String mem_1,String mem_2,String mem_3) {
mem1 = mem_1;
mem2 = mem_2;
mem3 = mem_3;/*Names of Group Members*/
combined_mem = new String(mem1+","+mem2+","+mem3+" ");
move_banner_thread.start();/*Starts the Thread*/
this.setFullScreenMode(true);/*Make the Full Screen Mode*/
}
/**
* paint
*
* @param graphics Graphics
* @todo Implement this javax.microedition.lcdui.Canvas method
*/
protected void paint(Graphics graphics) {
/*First of all getting Screen Hight and Width*/
int height = this.getHeight();
int width = this.getWidth();/*Get the Height and Width of Canvas*/
// Set the new Colour of Screen
graphics.setColor(60,100,90);
graphics.fillRect(0, 0, width, height);
/*Now setting the font*/
graphics.setFont(Font.getFont(Font.FACE_PROPORTIONAL,Font.STYLE_BOLD,Font.SIZE_LARGE));
int centerX = width / 2;
int centerY = height / 2;
graphics.setColor(255,255,255); // white
drawText(graphics, centerX, centerY - 1);
drawText(graphics, centerX, centerY + 1);
drawText(graphics, centerX - 1, centerY);
drawText(graphics, centerX + 1, centerY);
graphics.setColor(0,0,0); // black
drawText(graphics, centerX, centerY);
this.drawText(graphics,centerX,centerY);
/*Now giving Effect on screen*/
/*Moving Banner of Names*/
graphics.drawString(combined_mem,0,centerY+60,Graphics.HCENTER | Graphics.TOP);
// graphics.setFont(Font.getFont(Font.FACE_PROPORTIONAL,Font.STYLE_BOLD,Font.SIZE_MEDIUM));
}
private void drawText(Graphics g,int x,int y) {
int fontHeight = g.getFont().getHeight();
int textHeight = 3 * fontHeight;
int topY = y - textHeight / 2;
/*Drawing the Text with the required Properties*/
g.drawString("Home Security",x,topY,Graphics.HCENTER | Graphics.TOP);
g.drawString("&",x,topY + fontHeight,Graphics.HCENTER | Graphics.TOP);
g.drawString("Control System",x,topY + 2 * fontHeight,
Graphics.HCENTER | Graphics.TOP);
g.drawString("By",x,topY + 3 * fontHeight,
Graphics.HCENTER | Graphics.TOP);
}
public void run(){
/*Override run function*/
int centerX = getWidth()/2;
int centerY = getHeight()/2;/*Center point of screen is centerX,centerY*/
for(;{
try{
this.repaint(0, centerY + 50, getWidth(),
getHeight() - (centerY + 50));
/*repaints a specific region*/
Thread.sleep(250);/*Halt the Execution of this Thread*/
char ch = combined_mem.charAt(0);
combined_mem = combined_mem.substring(1,combined_mem.length());/*Trim the first Char*/
combined_mem += ch;/*Put the Trimed Char at the End*/
}catch(InterruptedException ie){
System.err.print(ie);/*Whats is the Exception*/
}
}
}
private void jbInit() throws Exception {
}
}
/************************end******************************/
Please help me anybody as soon as possible and i am looking forward for help from any Nokia Expert....any solution or any suggestion...any possible reason of error....
Thanks....

{
Reply With Quote


