×

Discussion Board

Results 1 to 14 of 14
  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    8

    How to identify keypad type of device using j2me (QWERTY or Normal Smart device keypa

    Hi,

    Can we identify keypad type of device using j2me (without calling any key pressed of canvas)?
    Please tell me if there is any direct or indirect way for this.

    Thanks in Advance,
    William

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

    Re: How to identify keypad type of device using j2me (QWERTY or Normal Smart device k

    There are many varieties of keypad, and no way to tell which you have.

  3. #3
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: How to identify keypad type of device using j2me (QWERTY or Normal Smart device k

    I have spent much time searching solution for the problem. See this:
    http://discussion.forum.nokia.com/fo...d.php?t=146480

  4. #4
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: How to identify keypad type of device using j2me (QWERTY or Normal Smart device k

    Quote Originally Posted by grahamhughes View Post
    There are many varieties of keypad, and no way to tell which you have.
    I have seen only 3 types of keypad in mobile phones:
    1. Numeric
    2. QWERTY
    3. QWERTY with 2 keys on single button

    May you let me know which are other types of keypad...

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

    Re: How to identify keypad type of device using j2me (QWERTY or Normal Smart device k

    There may be other reasons you want to know about the keypad. Games programmers, for example, may want to know the layout of the directional or numeric keys.

    As examples:

    A Nokia 3510i and its variants have only a two directional dpad, not four. Some devices have a four-way pad, but with no centre-click. Some Blackberry devices have a trackball instead of a pad.

    Sony Ericsson devices have a specialised "back" key, which gets attached to certain kinds of Command object (rather than a softkey).

    Some games use numeric keys for direction (especially if eight directions are required. This is a problem on devices like the Nokia 3650, Nokia 7600 or Siemens SX1, which do not have the conventional numeric layout. Similarly, some devices with QWERTY keyboards have the numeric keys in a conventional layout embedded in the QWERTY keys, while others have a separate numeric row.

    Softkeys can vary in number, and can be at the bottom of the screen or the side. User interface convention can vary ("select" on the left for Nokias or on the right for some Motorolas).

    And so on.

    These don't necessarily have the same impact as QWERTY/numeric, but they can affect usability and user documentation.

  6. #6
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: How to identify keypad type of device using j2me (QWERTY or Normal Smart device k

    Quote Originally Posted by grahamhughes View Post
    There may be other reasons you want to know about the keypad.
    The purpose of this for me is that I want to make a Textbox for user input on canvas (don't know about purpose of swaroopprajapat). So the "layout" of keys doesn't matter. What matters is that for which key press, what ASCII value is passed to keyPressed event. Lets say ASCII value 50 is passed to keyPressed twice and that too very fast. Now, on Numeric keypad this should put "b" on Textbox while on QWERTY keypad, this should put "22". Considering this purpose, I think there are only 3 types of keypad:
    Quote Originally Posted by arpit2agrawal View Post
    1. Numeric
    2. QWERTY
    3. QWERTY with 2 keys on single button
    I don't know anything about QWERTY keypad with 2 keys on single button.

    If you know anything regarding this topic, please post...

  7. #7
    Regular Contributor
    Join Date
    May 2008
    Posts
    90

    Re: How to identify keypad type of device using j2me (QWERTY or Normal Smart device k

    I don't think there is any standardized way (like properties) to get to know this. It's so much unsupported that all documentation says that you shouldn't use anything but native components (i.e. not Canvas based ones) for input. But that is of course crazy these days.

    What you can do is that you can actually query the device type/platform and dynamically configure your application based on that. You could include several implementations and/or configurations for the key mappings, but it shouldn't be that bad as most of the devices will have the numeric keypad and you only need to handle the few qwerty ones.

  8. #8
    Regular Contributor
    Join Date
    May 2008
    Posts
    90

    Re: How to identify keypad type of device using j2me (QWERTY or Normal Smart device k

    I don't know anything about QWERTY keypad with 2 keys on single button.
    These are SonyEricsson phones, like the P1 or the m600i. They have two keys on one physical button but your software shouldn't be concerned because there are actually two micro switches per button. So indeed it's just a way to spare on physical space but still it has a separate hardware key for every single letter. (The buttons can be pressed on the left or the right side.)

  9. #9
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: How to identify keypad type of device using j2me (QWERTY or Normal Smart device k

    Thanks atleta. Hope same is the case with phones of other companies like Blackberry

  10. #10
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: How to identify keypad type of device using j2me (QWERTY or Normal Smart device k

    After lots & lots of trial & error, I got one way to find out whether keypad is Numeric or QWERTY. Please let me know if this will work on all phones or not...
    Code:
            if((MyCanvas.getGameAction(48) == 0) && (MyCanvas.getGameAction(49) == 0) && (MyCanvas.getGameAction(50) == 0) && (MyCanvas.getGameAction(51) == 0) && (MyCanvas.getGameAction(52) == 0) && (MyCanvas.getGameAction(53) == 0) && (MyCanvas.getGameAction(54) == 0) && (MyCanvas.getGameAction(55) == 0) && (MyCanvas.getGameAction(56) == 0) && (MyCanvas.getGameAction(57) == 0)){
                //QWERTY Keypad;
            }
            else{
                //Numeric Keypad;
            }
    It works on Nokia 2626 (Numeric) as well as on Nokia E61i (QWERTY)

  11. #11
    Regular Contributor
    Join Date
    May 2008
    Posts
    90

    Re: How to identify keypad type of device using j2me (QWERTY or Normal Smart device k

    Nice hack, but I think you'd have to test on all devices or at least read the developer documentation for them anyway. You can't be sure of anything .

    Hope same is the case with phones of other companies like Blackberry
    I don't know what you mean. Yes, you can identify blackberries and once you did, you can use your specific strategy. You may want to have a look at lwuit.dev.java.net. That's a 'lightweight' (i.e. pure java, non-native) GUI toolkit and they do provide editable components like text fields, etc. I haven't tried them on a qwerty phone yet (I have a blackberry), but it quite probably works.

  12. #12
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: How to identify keypad type of device using j2me (QWERTY or Normal Smart device k

    Quote Originally Posted by arpit2agrawal View Post
    Thanks atleta. Hope same is the case with phones of other companies like Blackberry
    Quote Originally Posted by atleta View Post
    I don't know what you mean.
    I was saying that phones with QWERTY keypad with 2 keys on single button are manufactured by other companies like Blackberry also. So I hope this is the case:
    Quote Originally Posted by atleta View Post
    They have two keys on one physical button but your software shouldn't be concerned because there are actually two micro switches per button. So indeed it's just a way to spare on physical space but still it has a separate hardware key for every single letter. (The buttons can be pressed on the left or the right side.)
    with those phones also...

  13. #13
    Registered User
    Join Date
    Jul 2008
    Posts
    8

    Smile Re: How to identify keypad type of device using j2me (QWERTY or Normal Smart device k

    Hi,

    Code:
    if((MyCanvas.getGameAction(48) == 0) && (MyCanvas.getGameAction(49) == 0) && (MyCanvas.getGameAction(50) == 0) && (MyCanvas.getGameAction(51) == 0) && (MyCanvas.getGameAction(52) == 0) && (MyCanvas.getGameAction(53) == 0) && (MyCanvas.getGameAction(54) == 0) && (MyCanvas.getGameAction(55) == 0) && (MyCanvas.getGameAction(56) == 0) && (MyCanvas.getGameAction(57) == 0)){
                //QWERTY Keypad;
            }
            else{
                //Numeric Keypad;
            }
    I tested this on Sony 990 and it didn't work for that. But I guess I found the correct way of doing that:
    Code:
     protected static boolean isNumericKeyPad()
      {
         
          try {
                for (int i = 65; i < (65 + 26); i++)
                {
                  MyCanvas.getKeyName(i);
                }
                if(MyCanvas.getGameAction((int)'A') == Canvas.LEFT && MyCanvas.getGameAction((int)'D') == Canvas.RIGHT && MyCanvas.getGameAction((int)'W') == Canvas.UP && MyCanvas.getGameAction((int)'Z') == Canvas.DOWN)
                {
                    return false;
                }    
                return true;
          } catch (Exception e) {
               return true;
          }
      }
    I tested this on Sony 990 and it worked fine, I hope it should work for you also.

    Thanks for giving replays.
    Swaroop
    Last edited by swaroopprajapat; 2009-01-01 at 06:07.

  14. #14
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: How to identify keypad type of device using j2me (QWERTY or Normal Smart device k

    Quote Originally Posted by swaroopprajapat View Post
    Code:
     protected static boolean isNumericKeyPad()
      {
         
          try {
                //Part I
                for (int i = 65; i < (65 + 26); i++)
                {
                  MyCanvas.getKeyName(i);
                }
    
                //Part II
                if(MyCanvas.getGameAction((int)'A') == Canvas.LEFT && MyCanvas.getGameAction((int)'D') == Canvas.RIGHT && MyCanvas.getGameAction((int)'W') == Canvas.UP && MyCanvas.getGameAction((int)'Z') == Canvas.DOWN)
                {
                    return false;
                }
    
                return true;
          } catch (Exception e) {
               return true;
          }
      }
    Part I is OK
    But why Part II... If I put Part II then its returning true in Nokia E61i

Similar Threads

  1. Bluetooth Security: What exactly is an untrusted device?
    By rahulmcs in forum Bluetooth Technology
    Replies: 1
    Last Post: 2005-12-02, 06:26
  2. How to get the model type of a Series 60 device in j2me?
    By gobiguy in forum Mobile Java General
    Replies: 7
    Last Post: 2003-12-09, 06:01
  3. Replies: 0
    Last Post: 2003-10-28, 14:00
  4. Problem with Nokia D211 Linux Drivers
    By fiveam in forum Multimodecards
    Replies: 1
    Last Post: 1970-01-01, 02:00

Posting Permissions

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