Select item in list with default button

Forum for J2ME mobile games related topics including programming doubts, books and other resources for J2ME game development

Select item in list with default button

Postby Jokerman » Tue Feb 26, 2008 4:51 pm

Hi!

I hope this is a simple question which can be solved using the high-level API.
I have a list with several items and I would like to select an item of the list and simply press the default select button on my phone to run a command. The default select button on my SE-K750i is a round button which you use as a joystick.
Now I have to go to the menu on my phone by using a soft key and select the command there among all other commands.

I thought setting the priority of the command to '0' would solve it if the other commands have a higher priority, but it doesn't seem so.
Any ideas?

I have a list:
public list my_list = new list("title", Choice.IMPLICIT);

Populate it:
for (int i=0; i<list.length; i++)
my_list.append(list,null);

Add a command:
my_list.addCommand(my_command);
my_list.setCommandListener(this);

Command object:
my_command = new Command("Select", "Select Equity", Command.ITEM, 0);

Thanks for any input.
With kind regards
/Jokerman
User avatar
Jokerman
 
Posts: 2
Joined: Tue Feb 26, 2008 1:52 pm
Location: Sweden

Re: Select item in list with default button

Postby Jokerman » Tue Feb 26, 2008 10:29 pm

if (command == my_list.SELECT_COMMAND)
bla bla...

solved it....

list.SELECT_COMMAND is the defult command. You don't need to create an extra command.

Thank you!

/Jokerman
User avatar
Jokerman
 
Posts: 2
Joined: Tue Feb 26, 2008 1:52 pm
Location: Sweden

Re: Select item in list with default button

Postby DevelopmentTeam » Wed Feb 27, 2008 6:17 am

wow, Thanks a lot for giving the solutions here.
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India


Return to J2ME Games

Who is online

Users browsing this forum: No registered users and 1 guest

cron