×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jul 2012
    Location
    India
    Posts
    103

    Command is not working on LWUIT Form Screen

    Hi,
    i have created a Back Command on my LWUIT Form Screen ,But it is working sometimes and not working some times(for a couple of clicking with my mouse),any thing i have to do special?But my Exit command is working,which is available in different Form?Any one has Faced with the Similar kind of issue?
    Here my Code:
    Form form2 = new Form("Title");
    form2.addCommand(m_backCommand);
    form2.addCommandListener(new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
    System.out.println("Back");
    form1.show();
    }
    });

  2. #2
    Nokia Developer Expert
    Join Date
    Aug 2011
    Posts
    555

    Re: Command is not working on LWUIT Form Screen

    Hi pavanragi,

    What if you call
    Code:
    form2.setBackCommand(m_backCommand)
    ?

    I have tried the following code below which switches between two Forms by clicking on the Back Command

    Code:
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.midlet.MIDletStateChangeException;
    
    import com.sun.lwuit.Command;
    import com.sun.lwuit.Display;
    import com.sun.lwuit.Form;
    import com.sun.lwuit.events.ActionEvent;
    import com.sun.lwuit.events.ActionListener;
    
    
    public class Midlet 
    	extends MIDlet
    	implements ActionListener {
    
    	Command switchForms = new Command("switch");
    	
    	Form form1;
    	Form form2;
    	
    
    	protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
    
    	}
    
    	protected void pauseApp() {
    
    	}
    
    	protected void startApp() throws MIDletStateChangeException {
    		Display.init(this);
    		form1 = new Form("Form 1");
    		form2 = new Form("Form 2");
    		
    		form1.addCommand(switchForms);
    		form1.addCommandListener(this);
    		
    		form2.addCommand(switchForms);
    		form2.addCommandListener(this);
    		
    		form1.setBackCommand(switchForms);
    		form2.setBackCommand(switchForms);
    		
    		form1.show();
    	}
    
    	public void actionPerformed(ActionEvent ae) {
    		if(form1.isVisible()) {
    			form2.show();
    			System.out.println("Back to Form 2");
    		}
    		else {
    			form1.show();
    			System.out.println("Back to Form 1");
    		}
    	}
    }
    and I couldn't find any issues, even after several clicks on Back. Let us know, if this doesn't solve your problem.

Similar Threads

  1. How to display a Form Screen on LWUIT Tabs?
    By pavanragi in forum Mobile Java General
    Replies: 3
    Last Post: 2012-08-09, 09:42
  2. How to identify List item in lwuit Form Screen?
    By pavanragi in forum Mobile Java General
    Replies: 6
    Last Post: 2012-08-08, 08:39
  3. How to append LWUIT List screen to a LWUIT Form in j2me?
    By pavanragi in forum Mobile Java General
    Replies: 1
    Last Post: 2012-08-06, 07:01
  4. Form custom command is not working
    By Basit781 in forum Symbian User Interface
    Replies: 0
    Last Post: 2011-08-04, 18:11
  5. Form back command not working. Getting Kern_Exe3 error
    By Basit781 in forum Symbian User Interface
    Replies: 0
    Last Post: 2011-08-04, 16:55

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×