ProgressDialog in Thread stopps when closing G1

by Manfred » Fri, 06 Mar 2009 16:24:02 GMT


Sponsored Links
 Hi!

I have a Progress Dialog in an extra Thread running. Normally the user
will have the keyboard open, because something is to insert! So when
the Progress Dialog appears and the user close the keyboard, the
dialog dissappears and the application crashes. In the debugger i saw
the exception "View not attached to window manager". May because the
Dialog is not longer shown but the application want to remove it after
the calculation?

Here is the code where i start the dialog and the thread:
------------------------------------------------------------------------------------------
        alert=0;
        myProgressDialog = ProgressDialog.show(this,
                                "Please wait...", "Calculating..", true);
        new Thread()
        {
            public void run()
            {
                                try
                                {
                                        //Doing some stuff....
                                }
                                catch (Exception e)
                                {
                                        alert=2;
                                        alertText = e.getMessage();
                                }

                                myProgressDialog.dismiss();
                                mHandler.post(mCompleteRunnable);
            }
        }.start();
------------------------------------------------------------------------------------------

Does somebody know how to solve this?

Thanks!
--~--~---------~--~----~------------~-------~--~----~



ProgressDialog in Thread stopps when closing G1

by Manfred » Fri, 06 Mar 2009 16:53:59 GMT


 Thanks




--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


ProgressDialog in Thread stopps when closing G1

by Manfred » Fri, 06 Mar 2009 20:36:40 GMT


 For all who have the same problem, this helps:

Override this method:
        @Override
        public void onConfigurationChanged(Configuration arg0)
        {
                super.onConfigurationChanged(arg0);
                //Toast.makeText(this, "onConfigurationChanged",
Toast.LENGTH_SHORT).show();
        }

And in Manifest XML insert this line in the activity tag:
android:configChanges="keyboardHidden|orientation">

Now you have to handle yourself changes on orientation and
keyboardHidden, and as you can see in the overridden method, i do
nothing. So the onCreate() Method is not called if the orientation
changes or if the keyboard is slided out or in and therefore the
dialog do not dissappear!






--~--~---------~--~----~------------~-------~--~----~



ProgressDialog in Thread stopps when closing G1

by MrSnowflake » Sat, 07 Mar 2009 23:07:06 GMT


 lso using showDialog() and corresponding onCreateDialog and
onPrepareDialog() will have dialogs survive configuration changes!
(and it's a lot easier :)).

On 6 mrt, 13:36, Manfred <manfred.fettin...@gmail.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. How do I navigate to the program data with adb shell

On a real phone this will work with ROM with root access.




-- 

2. Why RIL.java implements CommandInterface twice

Maybe this group is not the right one to ask this question.

I am studying RIL and noticed RIL.java inplements CommandInterface
twice( extend BaseCommand implement CommandInterface). What is it
for?
Any design pattern here?

Best Regards
James

-- 

3. How to know the caller of ContentProvider

4. When call mWifiManager.isWifiEnabled , it crash. thanks in advance.

5. G. Checkout Declined Payments

6. AlertDialog.show() leaks when phone rotates

7. Set ringtone from raw resource?