Android - Non blocking spinning ProgressDialog
<p>I'm having a bad time with "ProgressThings". I have an app that dynamically changes the contents of the Views (and even the Views themselves might change, disappear, be re-added, so on). There are some classes that takes care of particular "styles" of the main Activity. One of them downloads a XML file, parses it (there is a specific class to handle this) and show some content to the user based on what was downloaded. </p>

<p>Anyway, my problem is that I wanted the ProgressDialog to be non blocking, so that the user could interact with other app's features while waiting. I have read some answers related to this problem (like <a href="http://stackoverflow.com/questions/6650415/android-how-to-make-a-progress-dialog-embedded-on-the-ui">this one</a>, for example), but I have not been successful so far. Changing to ProgressBar with the "setIndeterminate(true)" (for I want the spinning style) doesn't seen to be working (it simply doesn't appear).</p>

<p>The private class bellow is the one that I use to show the ProgressDialog. It is working the way I posted bellow, but it is blocking UI interactions =/.</p>

<pre><code>private class DownloadXmlTask extends AsyncTask&lt;String, Void, Boolean&gt; {
    private ProgressDialog mProgress;

    private int xmlType = 0;
    XmlHandler xmlHandler = null;

    DownloadXmlTask(){
        xmlHandler = new XmlHandler();
    }

    @Override 
    protected void onPreExecute(){

        mProgress = new ProgressDialog(context);
        mProgress.getWindow().setGravity(Gravity.CENTER);
        mProgress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        mProgress.setIndeterminate(true);
        mProgress.setMessage("Carregando...");
        mProgress.show();
    }

    @Override
    protected Boolean doInBackground(String... urls) {

        int count = urls.length;
        for(int i=0; i&lt;count; i++){
            parseXml(urls[i]);
        } 
        return true;
    }

    @Override
    protected void onPostExecute(Boolean result) {
        if(result == true){
            mProgress.dismiss();
            // Do something else

        }
    }

    /**
     * Parses the xml defined by the parameter's String
     * @param urlString The url's String
     */
    private void parseXml(String urlString){
        try {
            // Loads the url
            URL url = new URL(urlString);

            // Initializes the parser
            SAXParserFactory spf = SAXParserFactory.newInstance();
            SAXParser sp = spf.newSAXParser();

            // Sets the handler
            XMLReader xr = sp.getXMLReader();
            xr.setContentHandler(xmlHandler);

            // Parses
            xr.parse(new InputSource(url.openStream())); 

        }catch(Exception e) {
            // To something here
        }
    }
}
</code></pre>

<p>P.S.: I didn't put the code for the XmlHandler class for it is not necessary ;P</p>

<p>P.S.2: Thanks in advance for any help :D</p>
