ProgressDialog does not want to update the message

Waza_Be picture Waza_Be · Oct 16, 2010 · Viewed 17.8k times · Source

I just tried to implement a progressdialog and I have some issues to change the text during my long and complex calculations.

for (String aString:myStringArray){
    Log.v(TAG, aString);
    mProgressDialog.incrementProgressBy(1);
    mProgressDialog.setMessage(aString);
}

I can clearly see the incrementProgressBy working and my dialog updating, but the message does not change.

Any idea on how to make that work?

Thank a lot.

Answer

Waza_Be picture Waza_Be · Oct 16, 2010

Just found the answer, that's working fine:

runOnUiThread(changeMessage);

with that code:

private Runnable changeMessage = new Runnable() {
    @Override
    public void run() {
        //Log.v(TAG, strCharacters);
        m_ProgressDialog.setMessage(strCharacters);
    }
};