×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    12

    n96 is driving me crazy, please help.......

    Hi, I ve already opened another thread, but no answers. I ll try to be clear.

    I did an application which has been tested on about 30 devices. 3 (n96 included) have the same problem. The touch fire does not work.
    My code is like that:

    public class MyClass extends Canvas implements CommandListener

    public void keyPressed(int keyCode, int acceleration) {
    ...
    if (Canvas.DOWN == getGameAction(keyCode)) {
    else if ...
    else if (Canvas.FIRE == getGameAction(keyCode)) {

    This code works for all the device except n96 (and 2 other ones so far), for which only the fire touch is not working

    Please, help....

  2. #2
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    198

    Re: n96 is driving me crazy, please help.......

    Quote Originally Posted by nikkoSH View Post
    This code works for all the device except n96 (and 2 other ones so far), for which only the fire touch is not working
    You don't seem to be using Nokia's FullCanvas or GameCanvas. Is your Canvas in full screen mode? Which physical button are you expecting FIRE to be? Have you tried "0"?

    - Mike
    NAVTEQ Network for Develoopers
    The community for developing innovative location-based applications
    http://NN4D.com

  3. #3
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: n96 is driving me crazy, please help.......

    Hi,
    Before you proceeds ahead, can you please draw the key code for the every key pressed.just fill a rect and draw the codes...
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  4. #4
    Registered User
    Join Date
    Mar 2009
    Posts
    12

    Re: n96 is driving me crazy, please help.......

    Hi and thanks for your answers.
    I m not using Nokia's FullCanvas or GameCanvas, we just need to display some text, photos. But is there no way to manage it with Canvas? i m using the full screen mode.

    raj_J2ME , actually I can t catch the keycode for this button. It s like if it does not react.

    Have you guys already tried on this phone?

  5. #5
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    198

    Re: n96 is driving me crazy, please help.......

    Quote Originally Posted by nikkoSH View Post
    I m not using Nokia's FullCanvas or GameCanvas, we just need to display some text, photos. But is there no way to manage it with Canvas? i m using the full screen mode.
    You didn't say if you tried the "0" button. One thing is for sure, if you're not using the FullCanvas and you're not in full screen mode then it is NOT the center button. I've heard it said that Canvas in full screen mode can use the center button, but I've never been able to make it work. If you figure out how, please let me know!

    - Mike
    NAVTEQ Network for Developers
    The community for developing innovative location-based applications
    http://NN4D.com
    Last edited by mikemoore; 2009-03-25 at 15:57.
    Mike Moore
    NAVTEQ Network for Developers
    http://nn4d.com

  6. #6
    Registered User
    Join Date
    Mar 2009
    Posts
    12

    Re: n96 is driving me crazy, please help.......

    Hi,
    I've also seen in this forum people say if you use full screen mode with a canvas it works. It does not work for me or i did not understand something. I can t answer now for the 0 cause i m not using my laptop now.

    By the way, are you sure if i change my canvas in a FullCanvas it will works?

  7. #7
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: n96 is driving me crazy, please help.......

    getGameAction() is always trouble. There is no guarantee about which keys will map which actions. I recommend avoiding it.

    If you want to use keyPressed() for non-standard key codes (anything other than 0-9, * and #) then make sure you don't attach Commands or a CommandListener.

    If you have no Commands and no CommandListener, and you're still not getting events from the keys you want, then yes, you need to change the Canvas type. Try GameCanvas first (more compatibility). FullCanvas is a last resort.

    Cheers,
    Graham.

  8. #8
    Registered User
    Join Date
    Mar 2009
    Posts
    12

    Re: n96 is driving me crazy, please help.......

    Thanks for your answer graham.

    I do attach a CommandListener, didn t know it can be a problem... I ll try to manage without... I think it won t be too long to change my canvas in gamecanvas, but I saw it takes a lot of memory (due to the double buffer), so if the only reason for me to switch to GameCanvas is for the fire button which does not work on few phones, is it a good choice?

    When u say to avoid getGameAction(), do you mean use directly the keycode (ex: fire=-5)?

  9. #9
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Thumbs up Re: n96 is driving me crazy, please help.......

    Quote Originally Posted by nikkoSH View Post
    Hi and thanks for your answers.
    I m not using Nokia's FullCanvas or GameCanvas, we just need to display some text, photos. But is there no way to manage it with Canvas? i m using the full screen mode.

    raj_J2ME , actually I can t catch the keycode for this button. It s like if it does not react.

    Have you guys already tried on this phone?
    Well,since you are using Canvas then keypressed() method must be call on the every key pressed and you must be able to catch the key code....if yes then just follow like this
    as grahm suggesting avoid to use the getGameAction()..yeah you can use directly keycode to process the key pressed..
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  10. #10
    Registered User
    Join Date
    Mar 2009
    Posts
    12

    Re: n96 is driving me crazy, please help.......

    The point is I want a program wich works for all the nokia, not only the n96, it s why I d like if possible to don t use the keycode.
    Do you guys have a simple example with a fire key working in a n96.

    I took an example on the net:

    SimpleGameCanvas extends GameCanvas

    run(){
    int keyStates = getKeyStates();
    k=keyStates;
    }
    private void render(Graphics g) {
    g.drawString("salut", 20, 20, 0);

    tested on several nokia it works fine, but when I press the Fire button on a n96, nothing happened..... ;-( it stays to 0, like if no touch have been pressed)

  11. #11
    Registered User
    Join Date
    Mar 2009
    Posts
    12

    Re: n96 is driving me crazy, please help.......

    oups,

    instead of g.drawString("salut", 20, 20, 0); I meant g.drawString("key="+k, 20, 20, 0);

  12. #12
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    198

    Re: n96 is driving me crazy, please help.......

    Quote Originally Posted by nikkoSH View Post
    Do you guys have a simple example with a fire key working in a n96.
    You still haven't said what you expect the fire key to be. From other posts I see here on an N96 it is "0".

    You cannot use the center key without using FullCanvas.

    - Mike
    NAVTEQ Network for Developers
    The community for developing innovative location-based applications
    http://NN4D.com

  13. #13
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: n96 is driving me crazy, please help.......

    You say "fire key", but you're assuming the "fire key" will be the dpad centre... and there is no rule. "Fire" could be 5, 0, SEND, left-soft-key, or anything else. It depends on the device. That's why getGameAction() is confusing.

    Using non-standards key code (for softkeys and dpad) is a problem with portability, as not all devices have the same code. However, all Nokias do use the same codes. Don't put "-5" in your code. Create a class like:

    PHP Code:
    public class Device {
        public static final 
    int KEY_FIRE = -5;

    And refer to "Device.KEY_FIRE". This way, you can easily change the key codes if you want to support non-Nokia devices later. (Sony phones use the same key codes as Nokias.)

    If you want to use keyPressed() for non-standard keys (softkeys and dpad), then don't use Commands/CommandListeners at the same time.

    On the N96, softkeys will not send keyPressed() events for softkeys if there is an active CommandListener. However, if you setFullScreenMode(true), and don't attach any Commands, don't setCommandListener(), then you will get keyPressed() events. (I just checked!)

    Other advice: be careful if you expect keyReleased() events for softkeys. Some devices (non-Nokia) send only keyPressed(), no keyReleased() for these keys.

    Cheers,
    Graham.

  14. #14
    Registered User
    Join Date
    Mar 2009
    Posts
    12

    Re: n96 is driving me crazy, please help.......

    Thanks a lot graham,
    you re right, it s working fine when I don't use Commands/CommandListeners at the same time.
    I found also another way, it s to create a third command which will be displayed in the middle. It s working also pretty well.

    Thanks all for your answers and I hope to help others soon

  15. #15
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    198

    Re: n96 is driving me crazy, please help.......

    Quote Originally Posted by nikkoSH View Post
    you re right, it s working fine when I don't use Commands/CommandListeners at the same time.
    I found also another way, it s to create a third command which will be displayed in the middle. It s working also pretty well.
    I'd be grateful if you explained how you managed to get this to work. Are you using Canvas, GameCanvas or FullCanvas? Are you in full screen mode? Are you listening for the non-standard key code -5, or the game event FIRE? Are you talking about the Center button or the "0" button?

    - Mike
    NAVTEQ Network for Developers
    The community for developing innovative location-based applications
    http://NN4D.com

Similar Threads

  1. CCamera: StartViewFinderBitmapsL leaves on N96
    By gmsk19 in forum Symbian Media (Closed)
    Replies: 17
    Last Post: 2011-11-11, 08:01
  2. Unexpected "Certificate Error" on N96 -- typical fixes did not work
    By kludgey in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 1
    Last Post: 2009-02-12, 05:44
  3. [moved] Help my N96 Please.
    By cdix in forum General Development Questions
    Replies: 1
    Last Post: 2008-11-26, 19:51
  4. Access Point Connection Problem on N96... Help!
    By asenechalM5T in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2008-11-17, 15:00
  5. Rogue key event trap driving me crazy
    By slitchfield in forum Symbian
    Replies: 1
    Last Post: 2007-08-12, 16:40

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×