Nokia bug? The simulator runs without any response on the real machine.

Source: Internet
Author: User

Update 2006/2/18 today, we can see that the English name of the beginner mobile game programming language in the book is beginning mobile phone game programming. A sample program high seas seems to have been mentioned by me. I tried it for a moment. After it was uploaded to the real machine (my 6600), I quit. it seems that the people who write books are not very rigorous ..
: Http://www.michaelmorrison.com/mambo/index.php? Option = com_remository & Itemid = 54 & func = download & filecatid = 21

_______________________________________________________
Time: 2005/12/19
This is a program written a year ago. The code can be found in the remarks section. There is no problem in the simulator. But it does not respond after running on the real machine. It exits after running.
It is really confusing. I did the following troubleshooting:


1. It is suspected that Borland's JBuilder has expired and the new version of JBuilder has been re-installed.
2. I have modified JBuilder because of Chinese problems. therefore, it is suspected that JBuilder encoding is a problem. Change the JBuilder encoding to GBK. gb2312, compile-> upload to mobile phone-> Installation still does not work.
3. try to remove some code that will cause exceptions. finally, the simple code framework is left. however, compilation-> upload to mobile phone-> Installation still fails. (Comment out some code repeatedly, but the result still does not work .. there is no way. sleeping ...)
4. The next morning, I passed the code to lipeichuan, and the result was not acceptable. In this way, my development tools were rejected.
The next day, I re-built a project and re-wrote the code. Compile-> upload to mobile phone-> install OK !! (Is there a problem with the machine at home ?? At this time, I strongly suspect that the file encoding of windows and Windows XP is incompatible... good guys are going crazy, haha)
Because the time is relatively tight, I will not continue the test, and then write the program.

If that's all done, I guess I won't be able to find this bug. just a few months later, the same error happened again, which is exactly the same. Because of my previous experience, I thought it would be enough to create a new project, but this time it was difficult to make it happen .. compilation-> upload to mobile phone-> Installation still does not work.
... I am depressed...
From Sunday morning to afternoon to evening to night, I still repeat the previous operation to troubleshoot the error and hope to find the real cause, I am also lucky to hope that this time I can run it on my mobile phone .. the miracle did not appear until I accidentally did an operation, that is, I changed a function name. In the past, a function called update was removed, and this time it turned out OK ..
This is probably a place name offense... ft... I checked it. It seems that the keyword update is not explicitly forbidden ..
I flipped through the previous project code and used an update function name. It seems that this is a bug on the Nokia real machine and I didn't try to run it on other mobile phones, I am also preparing to complete the test. test whether the UPDATE function name is not supported only by Nokia ..
Download the testapp test program. codetest.rar source code.
Please report the results to me. Let's check if this bug exists ..
I have put this project on base.google.com... http://base.google.com/base/items? Customerid = 1015546 & offerid = 6306879176991597515
 
[Resource]
MIDlet. Java

Import javax. microedition. MIDlet .*;
Import javax. microedition. lcdui. graphics;
Import javax. microedition. lcdui. display;

// Constructor.
Public class quiz extends MIDlet {
Private quizcanvas menu;
Public quiz (){
Menu = new quizcanvas (this );
}

/**
* Startapp
*/
Protected void Startapp (){

Display. getdisplay (this). setcurrent (menu );
}

/**
* Pauseapp
*/
Protected void pauseapp (){
}

/**
* Destroyapp
*
* @ Param boolean0 Boolean
*/
Protected void destroyapp (Boolean boolean0 ){
}
Public void quitapp (){
Destroyapp (true );
Yydestroyed ();

}
}

Canvas. Java

Import com. Nokia. Mid. UI .*;

Import javax. microedition. lcdui. graphics;
Import javax. microedition. lcdui. image;
Import javax. microedition. lcdui. Font;
Import javax. microedition. MIDlet. MIDlet;

Public class quizcanvas extends fullcanvas implements runnable {

// Menu item definition.
Private Final byte gm_menu_start = 0;
Private Final byte gm_menu_set = 1;
Private Final byte gm_menu_help = 2;
Private Final byte gm_menu_about = 3;
Private Final byte gm_menu_exit = 4;

Private Final byte pl_start = 0;

Font font1 = javax. microedition. lcdui. Font. getfont (0, 1, 16 );
Font font2 = javax. microedition. lcdui. Font. getfont (0, 0, 8 );
//
Private byte curmenuid; // The current menu item.
Private image Bg1;
Private graphics offscreen;
Private byte gamestate;
Private quiz lunchquiz;

Public quizcanvas (MIDlet ){
This. lunchquiz = (quiz) MIDlet;
Bg1 = image. createimage (176,208 );
Offscreen = bg1.getgraphics ();
Gamestate = 0;
Curmenuid = gm_menu_start;
// Repaint ();
New thread (this). Start ();
}

// Update the screen. Draw the menu.
Public void Update (){
Drawmenu ();
}

// Draw a menu. Draw a menu based on its coordinates and figures.
Private void drawmenu (){
// Draw a menu.
Offscreen. setcolor (0x333333 );
Offscreen. fillrect (0, 0,176,208 );

Offscreen. setfont (font2 );
// Draw select rect.
Offscreen. setcolor (0x003366 );
Int DY = 68 + curmenuid * 21; // 89,110,135
Offscreen. fillrect (36, Dy, 111,18 );
Offscreen. setcolor (0 xffffff );
Offscreen. drawrect (36-2, dy-2, 111 + 2, + 18 + 2 );
// Dx, Dy
Offscreen. drawstring ("gamemenu 2006", 54,25, graphics. Top | graphics. Left );
Offscreen. drawstring ("Start game", graphics. Top | graphics. Left );
Offscreen. drawstring ("set parameters", graphics. Top | graphics. Left );
Offscreen. drawstring ("view help", 61,111, graphics. Top | graphics. Left );
Offscreen. drawstring ("exit game", 61,136, graphics. Top | graphics. Left );
}

/**
* Paint
*
* @ Param graphics
*/
Protected void paint (Graphics graphics ){
Graphics. drawimage (Bg1, 0, 0, graphics. Top | graphics. Left );
}

/**
* Run
*/
Public void run (){
While (gamestate! = 100)
{
Update ();
Repaint ();
Servicerepaints ();
//
Try {
Thread. Sleep (60 );
}
Catch (interruptedexception ex ){
}
}
Lunchquiz. quitapp ();
}
Public void keypressed (INT keycode ){
If (keycode = This. key_up_arrow ){
Curmenuid-= 1;
}
If (keycode = This. key_down_arrow ){
Curmenuid + = 1;
}
If (curmenuid <0 ){
Curmenuid = 3;
}
If (curmenuid> 3 ){
Curmenuid = 0;
}
If (keycode =-6 ){
Gamestatus = 100;
}
}

}

Java word list (51 in alphabetical order ):

Abstract, Boolean, break, byte, Case, catch, Char, class, const, continue, default,
Do, double, else, extends, final, finally, float, for, Goto, if, implements, import, instanceof, Int, interface, long, native, new, package, private, protected, public, return, short, static, strictfp, super, switch, synchronized, this, throw, throws, transient, try, void, volatile, while.

Java reserved word list (12 groups in alphabetical order): The Reserved Words in Java are the words that are not used in the current Java version but may be written into the later version.

Byvalue, cast, false, future, generic, inner, operator, outer, rest, true, var.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.