Watch out for XmlPullParser.nextText()

Jesse Wilson

[This post is by Jesse Wilson from the Dalvik team. —Tim Bray]

Using XmlPullParser is an efficient and maintainable way to parse XML on Android. Historically Android has had two implementations of this interface:

The implementation from Xml.newPullParser() had a bug where calls to nextText() didn’t always advance to the END_TAG as the documentation promised it would. As a consequence, some apps may be working around the bug with extra calls to next() or nextTag():

    public void parseXml(Reader reader)
throws XmlPullParserException, IOException {
XmlPullParser parser = Xml.newPullParser();
parser.setInput(reader);

parser.nextTag();
parser.require(XmlPullParser.START_TAG, null, "menu");
while (parser.nextTag() == XmlPullParser.START_TAG) {
parser.require(XmlPullParser.START_TAG, null, "item");
String itemText = parser.nextText();
parser.nextTag(); // this call shouldn’t be necessary!
parser.require(XmlPullParser.END_TAG, null, "item");
System.out.println("menu option: " + itemText);
}
parser.require(XmlPullParser.END_TAG, null, "menu");
}

public static void main(String[] args) throws Exception {
new Menu().parseXml(new StringReader("<?xml version='1.0'?>"
+ "<menu>"
+ " <item>Waffles</item>"
+ " <item>Coffee</item>"
+ "</menu>"));
}

In Ice Cream Sandwich we changed Xml.newPullParser() to return a KxmlParser and deleted our ExpatPullParser class. This fixes the nextTag() bug. Unfortunately, apps that currently work around the bug may crash under Ice Cream Sandwich:

org.xmlpull.v1.XmlPullParserException: expected: END_TAG {null}item (position:START_TAG <item>@1:37 in java.io.StringReader@40442fa8) 
at org.kxml2.io.KXmlParser.require(KXmlParser.java:2046)
at com.publicobject.waffles.Menu.parseXml(Menu.java:25)
at com.publicobject.waffles.Menu.main(Menu.java:32)

The fix is to call nextTag() after a call to nextText() only if the current position is not an END_TAG:

  while (parser.nextTag() == XmlPullParser.START_TAG) {
parser.require(XmlPullParser.START_TAG, null, "item");
String itemText = parser.nextText();
if (parser.getEventType() != XmlPullParser.END_TAG) {
parser.nextTag();
}
parser.require(XmlPullParser.END_TAG, null, "item");
System.out.println("menu option: " + itemText);
}

The code above will parse XML correctly on all releases. If your application uses nextText() extensively, use this helper method in place of calls to nextText():

  private String safeNextText(XmlPullParser parser)
throws XmlPullParserException, IOException {
String result = parser.nextText();
if (parser.getEventType() != XmlPullParser.END_TAG) {
parser.nextTag();
}
return result;
}

Moving to a single XmlPullParser simplifies maintenance and allows us to spend more energy on improving system performance.

Omnia PRO GO Launcher Ex Theme v1.0

Omnia PRO GO Launcher Ex Theme v1.0






Omnia PRO GO Launcher Ex Theme v1.0


Omnia PRO GO Launcher Ex Theme v1.0 apk

Requirements: Android 2.0 and up

Overview: Omnia PRO by PizeroDesign. Super High quality Premium Theme for “GO Launcher EX”


Omnia PRO GO Launcher Ex Theme v1.0


Please note: to install this theme you need to download GO Launcher EX first. Get it, it’s free!


FEATURES:

Omnia PRO GO Launcher Ex Theme v1.0

- Beautiful HD Wallpaper with Bokeh effect.

- Exclusive “Zero” icon pack.

- Silver Dock icons.

- High quality graphics.

- Great attention to details.


Omnia PRO by PizeroDesign: The most beautiful GO Launcher Ex Theme!


Free Omnia PRO GO Launcher Ex Theme v1.0 apk


Download


Mirror



Related Posts Plugin for WordPress, Blogger...


Tags: , , , , , , , , , ,




Get Updates


Subscribe to our e-mail newsletter to receive updates.


<form class="subscribe-form" action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true">>

<input class="email" type="text" name="email" value="E-mail" onfocus="if (this.value == 'E-mail') {this.value = '';}" onblur="if (this.value == '') {this.value = 'E-mail';}">/></input><input type="hidden" value="" name="uri">/></input><input type="hidden" value="" name="title">/></input><input type="hidden" name="loc" value="en_US">/></input><input class="button" type="submit" name="submit" value="Submit">/></input>


</form>


Share This Post


Tweet



Related Articles


GO Launcher EX Theme Glass v2.6

GO Launcher EX Theme Glass v2.6






GO Launcher EX Theme Glass v2.6


GO Launcher EX Theme Glass v2.6 apk

Requirements: for Android version 2.1 and higher, supports App2SD

Overview: New Glass Theme for GO Launcher EX. Subject performed in a glass style. Replaced wallpaper. Changed the top icons. All graphics excellence.


GO Launcher EX Theme Glass v2.6


I hope you enjoy theme!

Please rate and leave your comments

1. You need to have the latest version of GO Launcher EX installed to access the theme. (Search “GO Launcher EX” to download)

2. To apply the theme within GO Launcher EX: MENU> preferences> theme preferential

Attention: It will set your wallpaper automatically.


***You can look at other my themes having pressed my profile in a bottom of page an android a market or to find on search “Droindman”***


***The weather widget is used GO Weather***


Recent changes:

In the new version there was a function of increase in icons in the menu and on a desktop!

Specially for new version Go Launcher has altered all icons for the size 86*86

Now all 620 icons of excellent quality in the biggest size!


Free GO Launcher EX Theme Glass v2.6 apk


Download



Related Posts Plugin for WordPress, Blogger...


Tags: , , , , , , , , , ,




Get Updates


Subscribe to our e-mail newsletter to receive updates.


<form class="subscribe-form" action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true">>

<input class="email" type="text" name="email" value="E-mail" onfocus="if (this.value == 'E-mail') {this.value = '';}" onblur="if (this.value == '') {this.value = 'E-mail';}">/></input><input type="hidden" value="" name="uri">/></input><input type="hidden" value="" name="title">/></input><input type="hidden" name="loc" value="en_US">/></input><input class="button" type="submit" name="submit" value="Submit">/></input>


</form>


Share This Post


Tweet



Related Articles


Google Maps v6.0.3 World Navigation activated

Google Maps v6.0.3 World Navigation activated






Google Maps v6.0.3 World Navigation activated


Google Maps v6.0.3 World Navigation activated apk

Requirements: for all Android versions

Overview: Get Google Maps with Navigation (Beta), Places, and Latitude


Google Maps v6.0.3 World Navigation activated


*Navigation: Free, voice-guided GPS navigation system

*Places: Find, rate, and get recommendations for places

*Latitude: See friends on the map and check in at places


Keywords: Google Maps, Navigation, Places, Hotpot, Latitude, directions


Recent changes:

6.0.1 – 6.0.3

Bug fixes for newer devices


6.0.0

* Indoor maps (beta) are now available for select airports, shopping malls, and more. Learn more at g.co/indoormaps

* Menu added to the top toolbar for easy switching between common features.

* Updated home screen for Places, now with popular searches based on your location.

* Option to disable automatic screen dimming for Navigation.


Google Maps v6.0.3 ownhere Mod – With World Navigation activated

This map is for the country that cant use navigation on google map. It has been hacked and can be used by any country now.


Features:

worldwide navigation using Google Maps Directions

map tiles caching on SD card

force-enable MT. If you’re on Eclair or some custom Donut and don’t have multitouch zooming, then maybe this will enable it.

force-enable Buzz feature

fix for map shift issue in China

option to hide zoom buttons

installable on non-rooted devices


Installation for root:


1. In Titanium Backup, select Maps and make a backup.

2. Select Maps and wipe data, then uninstall.

3. Select Street View and wipe data, then uninstall

4. Install Google Maps 6.0.3 ownhere.apk

5. Go to market, and reinstall street view.


or ADB


first uninstall Maps from /system/app



adb remount
adb push /maps6.0.3-ownhere.apk /system/app


Free Google Maps v6.0.3 World Navigation activated apk


Download


Mirror




Related Posts Plugin for WordPress, Blogger...


Tags: , , , , , , , , , ,




Get Updates


Subscribe to our e-mail newsletter to receive updates.


<form class="subscribe-form" action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true">>

<input class="email" type="text" name="email" value="E-mail" onfocus="if (this.value == 'E-mail') {this.value = '';}" onblur="if (this.value == '') {this.value = 'E-mail';}">/></input><input type="hidden" value="" name="uri">/></input><input type="hidden" value="" name="title">/></input><input type="hidden" name="loc" value="en_US">/></input><input class="button" type="submit" name="submit" value="Submit">/></input>


</form>


Share This Post


Tweet



Related Articles


QuickPic v1.5.2

QuickPic v1.5.2






QuickPic v1.5.2


QuickPic v1.5.2 apk

Requirements: Android 2.0 and up

Overview: Quick Your Pictures! The best picture viewer/browser/gallery!


QuickPic v1.5.2


This is the best picture viewer/gallery/photo album in Android, you can even use it to replace the lazy stock Gallery, just as millions of users are doing.

Full screen viewing and slide show with best image quality, clear thumbnail previews.

Speed browsing tons of pictures, quick find your recent downloaded pictures, without background service, you can even include or exclude the specified folders to make more efficient scanning.

Easy hide your photos and videos from the gallery apps, even protect them with a password.

Play standard videos and animated-GIFs.

iPhone’ smooth experience: sliding shift or switch, single or double tap or pinch to zoom.

Rotate, shrink, crop pictures, set wallpaper with best image quality.

More file management features: sort, rename, create new folder, move and copy pictures.

It is free and no ads!

Tips:

Please BACKUP YOUR IMPORTANT PHOTOS before your do file operations!

Long press a thumbnail to move/copy to another or new folder. Enter multi-select mode to find the batch operations.

Include the picture folders only in the settings to speed up the scanning.

Click the title in the title bar to rename the file/folder.

Can’t sync Picasa or Facebook or other web album!

Can’t show 3D photos yet!

Can’t show TIFF!

App2SD will be available when the APK size >= 500K!

Warning, HTC make things incompatible:

Multiple sharing photos to HTC mail or bluetooth may not work in some versions of HTC sense!

Open a photo from SMS will fail because HTC want a gallery app with SMS reading permission!

There are hundreds of phones/tablets in Android, I am always doing my best to make my app working fine on every device! So, if you find any issue, before you post useless comments or rating, please try to send email to me, I will help you to fix it


What’s in this version:

QuickPic v1.5.2 apk

1. Recovery the menu command of create a new empty folder;

2. Keep same scale level after rotate screen;

3. Fix: sometime can not scan some folders;

4. Fix: memory leak when break scan folders;

5. Fix: sometime can not load picture when crop;

v1.5.1

1. Fix a bug of sort folders/files in Japanese(maybe caused the photos “disappear” in Japanese phones);

2. Output PNG file if source file is PNG or BMP when crop;

3. Fix: crash bugs in Android 4.0 with GPU acceleration.


Free QuickPic v1.5.2 apk


Download


Mirror



Related Posts Plugin for WordPress, Blogger...


Tags: , , , , , , , , , ,




Get Updates


Subscribe to our e-mail newsletter to receive updates.


<form class="subscribe-form" action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true">>

<input class="email" type="text" name="email" value="E-mail" onfocus="if (this.value == 'E-mail') {this.value = '';}" onblur="if (this.value == '') {this.value = 'E-mail';}">/></input><input type="hidden" value="" name="uri">/></input><input type="hidden" value="" name="title">/></input><input type="hidden" name="loc" value="en_US">/></input><input class="button" type="submit" name="submit" value="Submit">/></input>


</form>


Share This Post


Tweet



Related Articles


MobileWebCam v2.0

MobileWebCam v2.0






MobileWebCam v2.0


MobileWebCam v2.0 apk

Requirements: Android 1.5+

Overview: Use your Android as a simple mobile webcam via WIFI or Mobile Network!


MobileWebCam v2.0


Use your Android as a simple mobile webcam via WIFI or Mobile Network! The picture can be watched from everywhere with a browser or for example with my App WebLiveWallpaper, ftp upload, stored in Dropbox, sent with email or stored on your sdcard.


Use as simple but mobile timed webcam with refresh rates from seconds to hours, with motion detection or your defined daily activity times. High resolution pictures are also possible. Mark the pictures with text or image to advertise for your place or business.


This app provides me with a simple possibility to mail someone (my wife) and start refreshing a webcam view of what I see with one buttontap. Also it can work as a more static webcam with set activity times and picture imprint if you got a spare or partially broken phone you want to place somewhere connected to power running all the time …


Free MobileWebCam v2.0 apk


Download



Related Posts Plugin for WordPress, Blogger...


Tags: , , , , , , , , , ,




Get Updates


Subscribe to our e-mail newsletter to receive updates.


<form class="subscribe-form" action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true">>

<input class="email" type="text" name="email" value="E-mail" onfocus="if (this.value == 'E-mail') {this.value = '';}" onblur="if (this.value == '') {this.value = 'E-mail';}">/></input><input type="hidden" value="" name="uri">/></input><input type="hidden" value="" name="title">/></input><input type="hidden" name="loc" value="en_US">/></input><input class="button" type="submit" name="submit" value="Submit">/></input>


</form>


Share This Post


Tweet



Related Articles


ROM Manager Premium v4.8.0.7

ROM Manager Premium v4.8.0.7






ROM Manager Premium v4.8.0.7


ROM Manager Premium v4.8.0.7 apk

Requirements: Android 1.6+

Overview: Must have app for any root user. Make backups, flash ROMs, and own your device. ROM Manager is THE MUST HAVE APP for any Android root user. (Over 3 million downloads and counting!)


ROM Manager Premium v4.8.0.7


* Flash your recovery to the latest and greatest ClockworkMod recovery.

* Manage your ROMs via a handy UI.

* Organize and perform backups and restores from within Android!

* Install ROMs from your SD card.

* Install your favorite ROMs over the air!


Premium Version:

* Premium ROMs

* Receive notifications for when your ROM is updated!

* Automatic backups

* Install from QR Code

* Web Connect

* Support


What’s in this version:

ROM Manager Premium v4.8.0.7 apk

- 4.8.0.7 Updated flash_image to the ICS version.


If your ROM came with ROM Manager you’ll have to remove it before installing this.


Free ROM Manager Premium v4.8.0.7 apk


Download


Mirror



Related Posts Plugin for WordPress, Blogger...


Tags: , , , , , , , , , ,




Get Updates


Subscribe to our e-mail newsletter to receive updates.


<form class="subscribe-form" action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true">>

<input class="email" type="text" name="email" value="E-mail" onfocus="if (this.value == 'E-mail') {this.value = '';}" onblur="if (this.value == '') {this.value = 'E-mail';}">/></input><input type="hidden" value="" name="uri">/></input><input type="hidden" value="" name="title">/></input><input type="hidden" name="loc" value="en_US">/></input><input class="button" type="submit" name="submit" value="Submit">/></input>


</form>


Share This Post


Tweet



Related Articles


Apply to be a Chitika Publisher!
Related Posts Plugin for WordPress, Blogger...
 
android tablet © 2012 | Designed by Cheap TVS, in collaboration with Vegan Breakfast, Royalty Free Images and Live Cricket Score