You Are Here:

Community: Developer Discussion Boards

#1 Old Problem with commands - 2007-04-29, 17:03

Join Date: Mar 2007
Posts: 85
antonio5982
Offline
Regular Contributor
Hi guys!
I have a small problem using the commands, I have 2 forms in different classes and when I am in the second form I would like to be back in the first form....

this is the code:

I have 2 files: midlet and another file


public class midlet extends MIDlet implements CommandListener
{
private Display display;
private Form form;
private Command next,;
public void startApp()
{
display = Display.getDisplay(this);
Form form = new Form("");
next = new Command("Next",Command.ITEM,1);
form.addCommand(next);
form.setCommandListener(this);
display.setCurrent(form);
}

public void pauseApp()
{
}

public void destroyApp(boolean unconditional)
{
}

public void commandAction(Command c, Displayable displayable)
{
if(c==next)
OtherClass c = new OtherClass(display,form);
c.Method();

}
}




in OtherClass I did:

public class OtherClass
{
private Display display;
private Form form, form2;
private Command back;
public InsertNewUser(Display d, Form f)
{
display=d;
form=f;
}

private void Method()
{
form2 = new Form("");
back = new Command("back",Command.Back,0);
form2.addCommand(back);
display.setCurrent(form2);
form2.setCommandListener(new CommandListener( )
{
public void commandAction(Command c, Displayable d)
{

if (c==back)
{
display.setCurrent(form);
}
});

}



But when i press back the emulator doesn't cause any action....


Could someone help me please?

thanks
antonio
Reply With Quote

#2 Old Re: Problem with commands - 2007-04-30, 04:45

Join Date: Mar 2007
Posts: 46
gordon32
Offline
Registered User
public class OtherClass implements CommandListener
Reply With Quote

#3 Old Re: Problem with commands - 2007-04-30, 09:09

Join Date: Mar 2003
Posts: 2,280
Location: Israel
shmoove
Offline
Forum Nokia Champion
He's using an anonymous inner class for the listener so OtherClass doesn't need to implement it.

Put some debugging statements in your code so you can see where exactly it is failing. Does it reach commandAction()? Does it go into the if block?

shmoove
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems sending SMS with AT commands bow24el General Messaging 4 2007-02-15 05:46
PROBLEM IN DISPLAYING MENU COMMANDS pistha Symbian Networking & Messaging 1 2006-09-21 16:17
problem in carbide sameerbkamble Carbide.c++ IDE and plug-ins 1 2006-07-06 17:48
About 6230 Bt Problem eerkek Bluetooth Technology 17 2005-02-08 13:33
7210 Silent Problem MarkMckim Mobile Java General 1 2003-03-18 13:36

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d18645X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZentertainmentQ qfnZtopicQUqfnTopicZj2meQ qfnZtopicQUqfnTopicZjavaQ qfnZtopicQUqfnTopicZmediaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ