IT Community - Software Programming, Web Development and Technical Support

How I can catch command event in j2me?

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?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > Mobile Software Development > J2ME

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 07-25-2007, 04:42 AM
bluesky bluesky is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 667
bluesky is on a distinguished road
Question How I can catch command event in j2me?

How I can catch command event in j2me?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 07-25-2007, 04:58 AM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 881
kingmaker is on a distinguished road
Send a message via MSN to kingmaker
Default Re: How I can catch command event in j2me?

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
}
}
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 06-09-2009, 10:25 PM
jeiem jeiem is offline
D-Web Trainee
 
Join Date: Jun 2009
Posts: 1
jeiem is on a distinguished road
Default Re: How I can catch command event in j2me?

//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
}
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

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


All times are GMT -7. The time now is 04:14 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0