This is a discussion on How I can catch command event in j2me? within the J2ME forums, part of the Mobile Software Development category; How I can catch command event in j2me?...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| How I can catch command event in j2me? |
|
#2
| |||
| |||
| In your commandAction(Command,Displayable) for the CommandListener for that screen, you would use the following code pattern: public void commandAction(Command c,Displayable d) { switch(c.getCommandType()) { case Command.OK: // this is the OK command // do your stuff } } |
|
#3
| |||
| |||
| //try this it will help when you use threads in the command actions. private Command cmdSave; private Command cmdNext; public void commandAction(Command c, Displayable d) { if (c==cmdSave) { Thread th1 = new Thread() { public void run() { try { METHOD();//call your method here } catch (IOException ex) { ex.printStackTrace(); } } }; th1.start(); } else if (c==cmdNext) { //check if all the required fields have been filled Thread tha = new Thread() { public void run() { METHOD2(); } }; tha.start(); } private void METHOD() { //code code code } |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Catch Paste Event in Javascript | velhari | HTML, CSS and Javascript Coding Techniques | 0 | 12-04-2007 05:33 AM |
| How can we use AT commands in j2me? means how can we pass an AT command one phone to | mobilegeek | J2ME | 1 | 11-10-2007 01:35 AM |
| event.clientX and event.clientY is working in IE but not work in firefox? | senraj | HTML, CSS and Javascript Coding Techniques | 2 | 08-08-2007 04:27 AM |
| What is TRY/CATCH block in T-SQL? | oxygen | Database Support | 1 | 07-26-2007 03:19 AM |
| How to catch the 404 error in my web application IN ASP.NET? | kingmaker | ASP and ASP.NET Programming | 1 | 07-26-2007 12:05 AM |
Our Partners |