AssertionError on android.util.Xml.parse

by Cleverson » Fri, 23 Apr 2010 06:09:40 GMT

Sponsored Links

I'm getting an AssertionError when calling Xml.parse. This error
usually occurs when I run the app and keep switching the phone
connectivity from Wifi to 3G and vice versa. I checked the source code
of the android.util.Xml class and see something that I couldn't not
understand well, for example

    public static void parse(InputStream in, Encoding encoding,
            ContentHandler contentHandler) throws IOException,
SAXException {
        try {
            XMLReader reader = new ExpatReader();
            InputSource source = new InputSource(in);
        } catch (IOException e) {
            throw new AssertionError(e);

Is it "normal" to handle an IOException like it is done in this class?
I mean, why catching a checked exception and turn it to an
AssertionError? Should clients be supposed to catch AssertionErrors
when calling the parse method?

Thanks in advance!


Other Threads

1. To open a new image after clicking a imageButton/how to use onclick

Hii all,

I have three Image buttons as:

1.Sequences(This is an image having)
2.Videos(a video file)
3.Information(this is an image file)

    Now  what i want is that as user clicks on the imageButton
Sequences a new image should be open .when clicks on Videos, a new
video shoul be open and when clicks on Information An information
image opens.

i have tried to code something like:

package com.example.imageButton;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;

public class imageButton extends Activity {

    private static ImageButton seqIBtn;
    private static ImageButton vidIBtn;
    private static ImageButton infoIBtn;

    // Create a button click listener for the Done button.
    private final ImageButton.OnClickListener btnDoneOnClick = new
ImageButton.OnClickListener() {
        public void onClick(View v) {
        //now how to open new images after clicking here


    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {

        //Get pointers to the Views defined in main.xml
        seqIBtn = (ImageButton) findViewById(;
        vidIBtn = (ImageButton) findViewById(;
        infoIBtn = (ImageButton) findViewById(;

i am able to see my all the three images in my simulator.
Please help me


2. Create Sitemap


There is a sitemap <> tool which creates sitemaps
for website. Can someone test it on Android whether it is working or not

This is based on Microsoft's Silverlight Technology.



3. Security unlock swipe effect

4. How to speed up the Android emulator.

5. EditText

6. TranslateAnimation doesn't animate straight (X-only) but also in Y-direction (diagonal)

7. Android devices supporting OpenGL ES 2.0 (at least through NDK) as of September 2010