×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    38

    Touch event on midlet command

    Hi,

    I am creating application for touch devices for nokia.
    J2ME provides methods pointerpressed,release and drag on canvas.

    I have generated a canvas in full screen mode having commands.
    On click of "option" command, another command menu opens, which is having commands like Ok, Back, Next.

    Now to get the event of sub command menu I have to get that which command is clicked.

    My question is how can I get that particular command has been clicked?
    Application is for N97/Music express (no keyboard support). I just want the way out using touch functionality.
    keypress event is not at all useful for me.

    Thank you in advance.
    Rajiv

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

    Re: Touch event on midlet command

    Command events are received using the CommandListener interface.

    I strongly recommend you don't mix Commands and full-screen mode. Many devices will not display the Commands when in full-screen mode, making them unusable.

    Graham.

  3. #3
    Regular Contributor
    Join Date
    Dec 2009
    Posts
    59

    Re: Touch event on midlet command

    Your Canvas class has to implement CommandListener interface, and then you can use:
    Code:
    public void commandAction(Command c, Displayable d) {
        if (c == okCommand) doThis();
        else if (c == backCommand) doThat();
    }
    But like Graham said, it's a bad ideea to use Commands when using a Canvas in fullscreen mode.

  4. #4
    Registered User
    Join Date
    Nov 2009
    Posts
    38

    Re: Touch event on midlet command

    thanks...

    But I have used it already and I am not getting problem with display issue of command.
    I tested on some devices and menu and submenu are visible.

    I am having problem with command touch events.It's user defined commands. And I am getting events through key press method.

    commandAction will call when command is clicked, means commandlistener listens to it, Problem is that when I tap on device how can I tell my program that tapped place is command.
    Cant we use any other way other than getting x,y coordinates.


    Reason for not implementing x,y coordinate method::
    Think like I have 5 different views, having different command on each canvas. In that situation I have to take every coordinate manually for each command for every view. Is there any optimum solution?
    Last edited by rajivmodh; 2010-02-11 at 12:10.

  5. #5
    Registered User
    Join Date
    Nov 2009
    Posts
    38

    Re: Touch event on midlet command

    I am using canvas menu system. I searched out for other feasible option but i dont think J2ME api support anything like that, so finally I am starting to apply coordinate system. Will try to make it dynamic for reusability.

  6. #6
    Regular Contributor
    Join Date
    Dec 2008
    Posts
    58

    Re: Touch event on midlet command

    Try using LWUIT, its an easy way to make canvas midlets. Theres a lot of components, like forms, tabs, tables, labels, etc. And suports touch devices.


    https://lwuit.dev.java.net/
    http://java.sun.com/developer/techni...e/lwuit_intro/

  7. #7
    Registered User
    Join Date
    Nov 2009
    Posts
    38

    Re: Touch event on midlet command

    Hi,

    thanks for useful info.

    But will lwuit support s60 3rd, 5th edi devices and N97sdk?

    And how can I set touch event for submenu items using lwuit?

Similar Threads

  1. TRKProtocolPlugin: Failed to launch the application
    By tamhanna in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 26
    Last Post: 2010-07-08, 08:13
  2. Touch Screen Event
    By rati2010 in forum Symbian
    Replies: 1
    Last Post: 2009-01-09, 05:20
  3. Opening connection to the secure element fails when restarting the midlet.
    By tfroidcoeur in forum Near Field Communication
    Replies: 6
    Last Post: 2007-08-24, 08:38
  4. why I can't send the key "1" event
    By songlinhe in forum Symbian
    Replies: 3
    Last Post: 2007-05-30, 08:05
  5. Detect PAUSE event in midlet
    By ykhun in forum Mobile Java General
    Replies: 3
    Last Post: 2005-01-03, 20:09

Posting Permissions

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