[android-developers] Re: ProgressDialog in Thread stopps when closing G1

2009-03-07 Thread MrSnowflake

Also 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:
 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!

 On 6 Mrz., 09:53, Manfred manfred.fettin...@gmail.com wrote:



  Thanks

  On 6 Mrz., 09:30, Stoyan Damov stoyan.da...@gmail.com wrote:

   Search this forum for Dialog Survival Over Configuration Change

   On Fri, Mar 6, 2009 at 10:23 AM, Manfred manfred.fettin...@gmail.com 
   wrote:

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!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: ProgressDialog in Thread stopps when closing G1

2009-03-07 Thread Marco Nelissen

You should do all of your UI (and a progress dialog certainly counts
as UI) in the main thread of your application.


On Fri, Mar 6, 2009 at 12:23 AM, Manfred manfred.fettin...@gmail.com wrote:

 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!
 


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



[android-developers] Re: ProgressDialog in Thread stopps when closing G1

2009-03-06 Thread Stoyan Damov

Search this forum for Dialog Survival Over Configuration Change

On Fri, Mar 6, 2009 at 10:23 AM, Manfred manfred.fettin...@gmail.com wrote:

 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!
 


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



[android-developers] Re: ProgressDialog in Thread stopps when closing G1

2009-03-06 Thread Manfred

Thanks

On 6 Mrz., 09:30, Stoyan Damov stoyan.da...@gmail.com wrote:
 Search this forum for Dialog Survival Over Configuration Change

 On Fri, Mar 6, 2009 at 10:23 AM, Manfred manfred.fettin...@gmail.com wrote:

  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!


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



[android-developers] Re: ProgressDialog in Thread stopps when closing G1

2009-03-06 Thread Manfred

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!


On 6 Mrz., 09:53, Manfred manfred.fettin...@gmail.com wrote:
 Thanks

 On 6 Mrz., 09:30, Stoyan Damov stoyan.da...@gmail.com wrote:

  Search this forum for Dialog Survival Over Configuration Change

  On Fri, Mar 6, 2009 at 10:23 AM, Manfred manfred.fettin...@gmail.com 
  wrote:

   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!


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