There is no specific way to code for j2ME application that should run on touch screen devices. The touch screen behavior is almost determined by the implementation of the device. That means it is the responsibility of the device to recognize the touch events (touch screen events) and response for them appropriately. However there are set of things that might be useful for you when developing applications for touch screen devices.
You might be using Sun Java Wireless Tool kit as the mobile emulator/simulator for testing the application in the development environment. You may have noticed that the emulators available under the Sun Java Wireless Toolkit are no touch supported emulators. Therefore you can follow the steps given below to make them touch enable emulators.
You might be using Sun Java Wireless Tool kit as the mobile emulator/simulator for testing the application in the development environment. You may have noticed that the emulators available under the Sun Java Wireless Toolkit are no touch supported emulators. Therefore you can follow the steps given below to make them touch enable emulators.
Steps
- Go to the installation directory of the Sun Java Wireless Toolkit installation. Under that directory go to wtklib ---> devices directories. In my case, C:\WTK2.5.2_01\wtklib\devices. Then you will see a set of directories as below with the names of the mobile emulators available
- Then open one of the directory (Mobile Simulator) and open the properties file available for that simulator.
In my case, I have selected DefaultColorPhone Simulator and opened the DefaultColorPhone.properties file under that. The property file contains the properties of the Mobile Simulator. In order to enable the touch screen event of the selected simulator, change the touch_screen=true as the properties file. Otherwise make it as false. Once it is done, the emulator/simulator will be touch screen enabled.
Make sure that you are going to build the application (JAR file and JAD file) targeting the type of the device that is Generic/AnyPhone. This will make sure that you application will be run on both touch screen and non touch screen devices properly. This can be done by adding the following code segment for the Ant script (build.xml) of your Mobile Application.
<deviceRequirements>
<requirement name="Identifier" value="Generic/AnyPhone"/>
</deviceRequirements>
<requirement name="Identifier" value="Generic/AnyPhone"/>
</deviceRequirements>
No comments:
Post a Comment