|
| Java Multimedia for Mobile - Tutorials |
|
Online Tutorials How to use the Google map image You can use the map from Google. To do that you just create an image object and set its source property to: http://maps.google.com/staticmap?center=48.8566667,2.3509871&format=png32&zoom=14&size=480x640&key=(your Google Map Key) You can get your Google Map Key from the site: http://code.google.com/intl/fr/apis/maps/signup.html center is the latitude and longitude position in degree of the map center. You can define two variables $lat_var and $lon_var to get a map in a position entered dynamically by the user. http://maps.google.com/staticmap?center={$lat_var},{$lon_var}&format=png32&zoom=14&size=480x640&key=(your Google Map Key Here) See the GoogleMapDemo.eman sample enclosed with the JM-Mobile Editor for more detail. XML Data You can use the XML data to create your application. The XModel part allows declaring the XML data that will be used in your application. Using XML data you can:
To declare a XML data, you insert into the XModel part a XInstance element. To specify a XML data source for the XInstance element using its FileName attribute: the XML data source can be a local or online XML file or an URL of a web service that can provide a XML data stream. Each XInstance element has an identity Name, which will be used to access into the XML data. The formula to access into a XML data represented by a XInstance element is following: {$XPath:document( XInstance Name )/XPath}, in some particular case such as in an expression, you can use a simpler formula document( XInstance Name )/XPath To access into the XML data you must use the XPath, but there are only a subset of XPath supported. The XPath functions supported are:
Attention! The XML data source provided to the XInstance element must be the well-form XML data. Example: The NewYorkTimes sample has a XInstance element named nytimesData representing the XML file following: You can access to the title of each item by the specification as following: {$XPath:document(nytimesData)//item[index(DynamicMenu_6659)]/title} Where: nytimesData is the name of the XInstance element; index(DynamicMenu_6659) is the index function to determine the number of the current selected item of the XML menu template (XMenuTemplate) identified as DynamicMenu_6659, see the XMenuTemplate object part for more information about this object. To count the total number of the item elements, you can use the specification as following: count(document(nytimesData)//item) memoryManager attributeThe XInstance element has the memoryManager attribute that can tell the system free or keep the XML data in the heap memory each time the application is changed to another scene. If the XML data is only used in a scene or some few scenes, it is recommended to use the free value. Otherwise if the XML data is the principal data for entire application then use keep value for the memoryManager attribute, the XML data will be always on the heap memory, the translation between the screens could be more fluid. However be really attention when using the keep value. The free is default value. Variable There are two kinds of variable: System and User variables: System variableIt’s a set of predefined variable representing the proprieties of the mobile-phone where the application is running on, for instance, System screen size or Language, etc. User variableIt’s a way to define, to keep and to modify the states of user's interactions. By now JM-Mobile provides two primitives variable types: STRING and INTEGER. Modify the user variableOn an event occurred (begin, end, key pressed, etc.) author can choose to modify a user variable. With an INTEGER variable author can choose to set, subtract or plus a value to the variable; with an STRING variable author can choose to concat or replace a new string to the variable Using variableUsing of variable make the presentation of application more dynamical. In general, to use a variable we put a $ at the beginning of the variable’s name (e.g. $myScore) and put it inside a pair of {}, e.g., {$myScore} Using variable in the text contentBy example: We have a variable called myScore that keeps a score of user. In the end of application we want to show this score, we can create a Text object and edit its text content as following: “My score {$myScore}” Using variable in the FileName attribute of an image objectThis application of variable allows changing to corresponding image content with the situation of the user’s interaction. By example: We have a string variable called stateOfMind that can take a “happy”, “sad”, “lovesick”, etc. then we want to show an image corresponding with a state of user in the application, we can create an image object with its FileName attribute specified as following: “…/res/images/{$stateOfMind}.png” Scene The structure of JM-Mobile project allows author to organize his/her project following the scenes, each scene presents a part, a period, a topic/subject of the multimedia project. There are two types of scene provided: GenericScene and SlideshowScene. The GenericScene is a neutral structure that allows to edit the general multimedia presentations. With the particular multimedia presentations such as Slideshow, Test, Quiz, Magazine, etc. if there are the particular scene structures for these particular presentations, the edition and management of these presentations will be much more easily. However, only the SlideshowScene structure is provided by default. If you want edit the other specific scenes please contact us at support@jm-mobile.com. Performance hint "Scene" provides the ways to structure your project in different parts that will be presented exclusively. Avoid creating the big scenes which contain many rich media such as images. The big scenes will make the time to initial them to be long, in addition these scenes maybe couldn't be loaded on the weak cell-phone systems. |
|