DeeJay Nacpil
DeeJay Nacpil

Reputation: 1

(J2ME polish) Click gesture for touchscreen support

im trying to follow this, but got no luck. I'm using treeItem or Choicegroup and it can be selected but can't be clicked, like when clicked, it will go to the next page.

I don't wanna use X and Y coz my Item is dynamic which it was generated through XML. therefore, the item location will be changed. I want a touch pointer for a specific item like the choice group that Im using.

http://www.enough.de/products/j2me-polish/documentation/lush-ui/touch-support.html#gesture-click

Upvotes: 0

Views: 264

Answers (1)

vITs
vITs

Reputation: 1560

You have Choicegroup and you want that on click of item it should go to next page then: you can use :

choicegroupname.addCommand(command of Command.OK type, say commandOpen);

then,you can set setItemCommandListener to commandOpen and in commandAction you can traverse choicegroup so that you can get focused index and you do your code there,then break.Hope this helps.

you can do this like:

    commandOpen.setItemCommandListener(new ItemCommandListener() {
        public void commandAction(Command cmd, Item arg1) {
            //size will be count of items
            for(int i=0 ; i < size ; i++){
                if(choicegroupname.focusedIndex== i){
                    //Do your code
                    return;
                }
            }
        }
    });

Upvotes: 0

Related Questions