Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8284675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:11:37+00:00 2026-06-08T11:11:37+00:00

It was running perfectly fine till yesterday… I am new to android programming ,

  • 0

It was running perfectly fine till yesterday… I am new to android programming , Any help would be great..
In my app I am parsing a downloaded xml file and then creating a dynamic UI…
Here is a snippet of my code..

private class ParseXML extends AsyncTask<Integer, Integer, Document>{

    public void onPostExecute(Document d) {


        ParseDocument(d); }



    @Override
protected Document doInBackground(Integer... params) {
    // TODO Auto-generated method stub
     DocumentBuilderFactory dbf= DocumentBuilderFactory.newInstance();

    try {
        //Uri uri = Uri.parse("android.resource://com.example.xml_parser/raw/options");
        InputStream is=getResources().openRawResource(R.raw.options);

        DocumentBuilder db = dbf.newDocumentBuilder();
        dom=db.parse(is);
        Log.i(TAG,"parsing done");

    }

    catch(ParserConfigurationException pce){
        pce.printStackTrace();
    }
    catch(SAXException se){
        se.printStackTrace();
    }
    catch(IOException ioe){
        ioe.printStackTrace();
    }
    return dom;


}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T11:11:39+00:00Added an answer on June 8, 2026 at 11:11 am

    The mistake is , you are trying to parse a XML in your Main UI thread. This means that you are restricting the user from performing actions with the UI. And in Andorid it is to be noted that, whenever a application doesn’t respond for more the 5 seconds you will be throwed with Applicaation Not Responding Dialog.

    So what you have to do is, use AsyncTask to parse your XML and then update your Ui from it.

    Here is a example ,

    https://stackoverflow.com/a/5806402/603744

    AsyncTask contains three methods namely,

    1. doInBackground -which is equivalent to your Thread.
    2. onPostExcecute-Called once doInBackground completes its Task.
    3. onPreExecute-Called before doInBackground gets Called.

    The 2nd and 3rd methods are related to UI, and you can perform any UI based actions here, and 1st method is your Background thread where you have to do your Immense Calculations, thus not affecting your UI.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So... this is beyond strange. I had an app that was running perfectly fine
Error I tried this page to run on local, it is running perfectly fine
I have a rails app running on passenger standalone, which is working perfectly. I
I changed some code on an android application that was working perfectly fine at
I have a perfectly fine running FragmentActivity with a smooth horizontal sliding between the
I have a .NET CF 1.1 application that has been running perfectly fine for
The app works perfectly fine on the simulator and on the device. After adding
my app was working perfectly fine, until I cleaned the targets and deleted the
I have my default website running on port 80, running perfectly fine. When I
The following script below is not running in IE7 but works perfectly fine in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.