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. referring to res-id across packages

Hi:

  In the example
http://code.google.com/android/samples/ApiDemos/src/com/google/android/samples/view/LabelView.html
refers to
http://code.google.com/android/samples/ApiDemos/res/layout/custom_view_1.html

In java file, I see code to access new derived attributes using
"R.styleable.LabelView_textColor"

Can I access "android:background" in Java??
Given that the LabelView resides in a different package, what is the
programmatic way to access android:background in java code?  Is this
prohibited?

thanks
Jey

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

2. How to use a WindowAnimation?

This seems like a necessary feature to use in order to transition from
one activity to another in such a way that they animate synchronously
(one slides out while the other slides in, etc).

http://code.google.com/android/reference/android/R.styleable.html#WindowAnimation

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

3. Android Reviews

4. scalable vector graphics scalable vector graphics scalable vector graphics

5. scalable vector graphics scalable vector graphics scalable vector graphics

6. (D)GPS good to 10 cm

7. How to detect item selected in Spinner View as selecting different items