So I have the body of my oncreate method something like this:
<code>
pd = ProgressDialog.show(this,
                                                                
"Calculating...",
                                                                "Please be 
patient. ",
                                                                true, false);
                                Thread thread = new Thread(this);
                                thread.start();

</code>

My activity also extends Runnable so here is the run method along with
the handler:
<code>
public void run() {
        Thread.sleep(25000L);
        // in real world some calculation call would go here
                handler.sendEmptyMessage(0);

        }

        private Handler handler = new Handler() {
                @Override
                public void handleMessage(Message msg) {

                        MyActivity.this.populateMainView();
                        pd.dismiss();
                }
        };
</code>


All of the above works great unless someone changes the screen
orientation while the calculation is running.  If the orientation
changes the OnCreate method runs again.  Additionally, if someone
changes the orientation _AFTER_ the run method has completed (and the
view has been populated), The onCreate Runs again and the values are
recreated even though the data has not changed. I want my method views
to reorient without affecting the state of my thread.  What is the
right way to do this?  I know there is a very basic concept of
activity lifecycle that I am missing, but I cannot find anything about
this anywhere.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to