×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jul 2012
    Posts
    25

    Nokia LWUIT gesture recognition

    Hello All,

    Thanks Nokia for releasing the LWUIT for the Series 40 below.


    http://projects.developer.nokia.com/LWUIT_for_Series_40

    I was very encouraged that Nokia help support multitouch features for apps built using LWUIT after going through the Wiki below. However, can I also know if there is an example for gesture recognition for LWUIT apps? Thanks in advance.

    http://projects.developer.nokia.com/...lTouchFeatures

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

    Re: Nokia LWUIT gesture recognition

    Hi ChinLoong,

    To my knowledge, there aren't yet any published Java Developer Library Code Examples that combine LWUIT for Series 40 and Gesture Events. Here is a very simple LWUIT MIDlet that displays an empty LWUIT Form on the screen and at the same time, receives Gestures Events:

    Main MIDlet:
    Code:
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.midlet.MIDletStateChangeException;
    
    
    import com.sun.lwuit.Display;
    import com.sun.lwuit.Form;
    
    
    public class GestureLWUITMIDlet 
    	extends MIDlet  {
    
    	Form form;
    
    	
    	protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
    		// TODO Auto-generated method stub
    	}
    
    	protected void pauseApp() {
    		// TODO Auto-generated method stub
    	}
    
    	protected void startApp() throws MIDletStateChangeException {
    		
    		Display.init(this);
            
            form = new Form("Nokia LWUIT Components");
            Handler handler = new Handler(form);
            form.show();
            
    		
    		
    	}
    
    
    }
    Supportive GestureHandler class:
    Code:
    import com.nokia.lwuit.GestureHandler;
    import com.nokia.mid.ui.gestures.GestureEvent;
    import com.sun.lwuit.Form;
    
    
    public class Handler
    	extends GestureHandler {
    	
    	Handler(Form form) {
    		GestureHandler.setFormGestureHandler(form, this);
    	}
    	
    	public void gestureAction(GestureEvent event) {
    		int type = event.getType();
    		switch(type) {
    			case 49279: 
    				System.out.println("GESTURE_ALL");
    				break;
    			case 4:
    				System.out.println("GESTURE_DRAG");
    				break;
    			case 8:
    				System.out.println("GESTURE_DROP");
    				break;
    			case 16:
    				System.out.println("GESTURE_FLICK");
    				break;
    			case 2:
    				System.out.println("GESTURE_LONG_PRESS");
    				break;
    			case 32:
    				System.out.println("GESTURE_LONG_PRESS_REPEATED");
    				break;
    			case 64:
    				System.out.println("GESTURE_PINCH");
    				break;	
    			case 32768:
    				System.out.println("GESTURE_RECOGNITION_START");
    				break;
    			case 16384:
    				System.out.println("GESTURE_RECOGNITION_END");
    				break;	
    			case 1:
    				System.out.println("GESTURE_TAP");
    				break;	
    		}
    		
    	}
    
    }
    Please note that this simple example, only prints the type of the gesture event that the MIDlet has just received in the console (via System.out). Feel free to expand this example by adding your code under each GestureEvent, to cover your use case.
    Last edited by skalogir; 2012-07-17 at 15:14.

  3. #3
    Registered User
    Join Date
    Jul 2012
    Posts
    25

    Re: Nokia LWUIT gesture recognition

    Excellent! Thanks you very much! I'll try this out.

Similar Threads

  1. Voice Recognition in QT/QML like in Nokia Maps
    By alva93 in forum [Archived] Qt SDKs and Tools
    Replies: 1
    Last Post: 2012-06-18, 06:59
  2. Gesture Api with Lwuit component?
    By karuna. in forum Mobile Java General
    Replies: 0
    Last Post: 2011-04-07, 07:37
  3. [moved] CA root certificate recognition within Nokia and Symbian applications
    By atilla.biler in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 1
    Last Post: 2010-02-22, 07:41
  4. Accelerometer Based Gesture Recognition
    By ranco in forum [Archived] Flash Lite on Nokia Devices
    Replies: 2
    Last Post: 2010-01-22, 12:07
  5. Gesture recognition
    By djsid in forum Symbian
    Replies: 9
    Last Post: 2008-08-12, 21:14

Posting Permissions

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