Android, the most commonly used smartphone platform, works on both smartphones and mobile tablets. Motorola XOOM is an Android Tablet. In this article, learn to create and parse an XML document on an Android device. For outputting XML, you can use the WorldFree4U APK standardjavax.xml.transform.Transformer
class. To parse XML on Android, you can use the DOM and SAX parsers. The org.xmlpull.v1.XmlPullParser pull parser is also an option for parsing XML. The examples in this article use the Android Platform 3.0 for processing XML. Reaver APK
Download the example application used in this article.
To follow along with the examples in this article, install and configure the following software See Related topics for links. iLauncher APK
Select Platform 3.0 and API 11 for the AVD.
In this section, you create an XML document on Android. The first step is to create an Android project.Clash Of Clans MOD APK
CreatingXML
CreatingXML
android.xml
CreatingXML
). An activity represents a user interaction. The class extending the Activity
class creates a window for a UI.CreatingXML
, which extends the Activity class.Figure 2 shows the directory structure of the Android project CreatingXML.
In the res/layout/main.xml file, specify the layout of the Android UI components. Create a LinearLayout
and set android:orientation
to vertical
. In this example, you'll display the XML document as a text message. Add a TextView
element with id xmlresult
to display the XML document, as in Listing 1.