Hi there brainiacs,

I'd like to ask about how to proper handle progressDialog in Thread,
since gettings the error from subject.

My code:

                                                                Thread 
logThread = new Thread()
                                                                {
                                                                        String 
result = new String();

                                                                        
@Override
                                                                        public 
void run()
                                                                        {
                                                                                
Looper.prepare();

                                                                                
try
                                                                                
{
                                                                                
        result = ofsomesomeoperation();
                                                                                
}
                                                                                
catch (NoSuchAlgorithmException e)
                                                                                
{

                                                                                
}
                                                                                
catch (IOException e)
                                                                                
{

                                                                                
}

                                                                                
logHandler.post(new Runnable()
                                                                                
{
                                                                                
        public void run()
                                                                                
        {
                                                                                
                if (result.equals(something1))
                                                                                
                {
                                                                                
                        dialogLogProg.dismiss();
                                                                                
                        showDialog(dialog_something1);
                                                                                
                }
                                                                                
                else if (result.equals(something2))
                                                                                
                {
                                                                                
                        dialogLogProg.dismiss();
                                                                                
                        showDialog(something2);
                                                                                
                }
                                                                                
                else
                                                                                
                {
                                                                                
                        dialogLogProg.dismiss();
                                                                                
                        Intent newint = new Intent(Example.this,
NewInt.class);
                                                                                
                        startActivity(newint);
                                                                                
                        Example.this.finish();
                                                                                
                }
                                                                                
        }
                                                                                
});
                                                                                
Looper.loop();
                                                                        }
                                                                };
                                                                
logThread.start();

Problem occurs when a dialog progress appears and I change my phone
orientation, it freezes and crashes.

Greetings.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to