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. If you wondered why alternative app markets exist...

Are you sure the link is right? I'm just seeing something about wordpress
themes?






-- 
Shane Isbell (Co-founder of SlideME - The Original Market for Android)
http://twitter.com/sisbell
http://twitter.com/slideme

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

2. What is the intended usage of the "Next" and "Done" keys on the soft keyboard

The "Next" key seems to move to the next item that could interact with
the keyboard.

The "Done" key is less clear to me.  It sends in a
KeyEvent.KEYCODE_ENTER
event.  Is it possible to distinguish this event from the down-and-
left-arrow key
that also sends in a KeyEvent.KEYCODE_ENTER?  It appears that you get
either but not both "Done" or down-and-left-arrow buttons on the soft
keyboard.

Am I missing some documentation about this?

Is it "good UI" to have the "Done" key execute the action that would
normally
be done on an "OK" button?  E.g. for a username and password dialog
that has
two text fields and an OK button the user touches the username field,
gets
the soft keyboard, types, presses "Next", types, presses "Done" and
the
dialog submits the username and password and goes away.

Or is it "good UI" to force the user to explicitly touch the OK
button?  Possibly
having to also manually dismiss the soft keyboard if it covers up the
OK button.

tia,
  mike


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

3. Large number of Contacts - DB corruption

4. Map not working (again)

5. OpenGL 2D Game Framework

6. coarse versus fine location provider

7. Virtual touch area for an ImageButton