Archive for aprilie, 2011

Cum sa folosesti kXML pentru a parsa fisiere XML in aplicatii J2ME

kXML este un parser simplu pentru documente XML, conceput special pentru medii de dezvoltare cu restrictii asupra memoriei disponibile, cum ar fi Applet-urile sau dispozitivele mobile ce suporta aplicatii Java sau MIDP (MIDP este un standard ce indica profilul software al dispozitivului).

Problema aplicatiilor de tip J2ME MIDlets este data de faptul ca exista dispozitive mobile care nu suporta API-ul standard pentru prelucrarea documentelor XML definit de pachetul aditional JSR 280. O solutie la aceasta problema este utilizarea unui parser independent si cu cerinte minimale care sa fie rapid dar si cu un impact mic asupra memoriei disponibile (in special cea virtuala). Doua solutii posibile sunt kXML si NanoXML.

Read the rest of this entry »

, ,

1 Comment

How to use GPS location services and Google Static Map API in J2ME MIDlets

Today, most mobile devices come with a GPS module or can connect to one using Bluetooth services. These devices come with support for the Location API for J2ME under JSR-179 that allow J2ME MIDlets applications to query the GPS module for geo-location coordinates. Also mobile applications integrate location based services and one increasingly used it to provide maps images using Google Maps or Google Static Maps. The later is accessible through Google Static Maps API V2, which is an open and free service (no longer requires a Maps API key) and more efficient as it minimizes network transfers.

In this article it is described and developed a fully MIDlet application that gets coordinates from the mobile device GPS module and use them to display a Google static map for that location. The application can be tested on the emulator or on a real device that has a GPS module incorporated.
Read the rest of this entry »

, , ,

8 Comments

How to use kXML to parse XML files in J2ME projects

kXML is a small XML pull parser, specially designed for constrained environments such as Applets, Personal Java or MIDP devices.

The problem for J2ME MIDlets is that there are mobile devices that don’t support the XML API for Java ME additional package (JSR 280). In order to solve this problem, we need an independent and lightweight XML parser that must be fast and with a small impact on the memory. Two possible solutions are kXML and NanoXML.

Read the rest of this entry »

,

4 Comments

How to parse XML, RSS feed with kXML in a J2ME MIDlet

More an more mobile devices are used to access Internet and connected services. One efficient way to transfer data between different platforms and technologies is to use XML files, which are simple text files formatted accordingly to the XML rules.

IN order to process an XML file and to extract needed data you need a XML parser which is a text process engine.

Read the rest of this entry »

, ,

7 Comments

Tutorial Java SCJP – #16 Constructors

In a class you can define methods, but there is a special type of methods which are used to solve a particular problem, to construct objects. Constructor methods are special because of their role and because they have a lot rules regarding declaration and usage.

Read the rest of this entry »

6 Comments

Tutorial Java SCJP – #15 Wrapper classes for primitive types

In Java there are 2 important categories of data types: references and primitives. Most of the time, numeric values, chars and boolean values are used as primitives because it is more efficient as processing speed and memory requirements. Despite that, there are scenarios (like using Collections) when it is needed to store primitive values inside objects. For that, Java provides a set of classes used to wrap primitive values in an object.

Read the rest of this entry »

2 Comments