Jump to content
  • Advertisement
Sign in to follow this  
Goguis

Having Trouble with Key Input in Mobile Handsets.

This topic is 4059 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys. I'm using the value -7 to identify the Right Soft key action in some Nokia Phones... but it doesn't work. In J2ME Polish they say it's the right value. :S I have the Command Listener deactivated. Regards.

Share this post


Link to post
Share on other sites
Advertisement
That's strange. Usually when you don't get events for the softkeys it's either because you are not in full screen mode or because you have added Commands to you Canvas. You say you haven't done either.

You should add some code that draws the key code on the display when a key is pressed and see if it is getting called when you press the softkey, and what code it is giving.

shmoove

Share this post


Link to post
Share on other sites
Here's the code i'm using. I just don't get it. I use KEY_NUM0 or any other and it doesn't work either. I use the UP_PRESSED and it works. :S Maybe it's because i'm using GameCanvas? Should i use just Canvas?

[EDIT]
I just noticed that if i use just UP, and not UP_PRESSED, it doesn't work. This means that i need to use
Thanks shmoove.

[EDIT2]
Damn... my game is made based on GameCanvas, not on Canvas. :S If thats the problem... ufh, is there anything i can do to avoid adapting it to canvas?



public void inputInGame()
{
if(keyStates==0)
{
keyStates = getKeyStates();

switch(keyStates)
{
case UP_PRESSED:

break;
case DOWN_PRESSED:

break;
case LEFT_PRESSED:

break;
case RIGHT_PRESSED:

break;
case FIRE_PRESSED:

break;
case -7:
isMenuInGame=true;
break;
default:
break;
}
}
keyStates = getKeyStates();
}



[Edited by - Goguis on June 10, 2007 12:10:04 PM]

Share this post


Link to post
Share on other sites
Shmoove! At last I figured it out!. I was using getKeyState() when i should be using

public void keyPressed(int keyCode)
{

}

Ufh, i started to freak out! lol

Thanks for all the help!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!