Hi Android Developers,

I have described my query in the code snippet below - the crux is
this:

I am passing a member variable of AsyncTask from onPostExecute method
to a method of the UI thread as below - is it safe OR am I doing
something very wrong here?

        private class Person
        {
                //member variables
        };

        private class PostManager
        {

                private class PostTask extends AsyncTask<Person, Integer, 
Integer>
                {
                        private Person mPersonToPostTo;

                        protected Integer doInBackground(Person... params)
                        {
                                //do some work
                        }

                        @Override
                        protected void onProgressUpdate(Integer... values)
                        {
                                super.onProgressUpdate(values);

                                //QUESTION - Is passing mPersonToPostTo like 
this safe?
                                postingProgressed(mPersonToPostTo, values[0]);
                        }

                        @Override
                        protected void onPostExecute(Integer result)
                        {
                                //QUESTION - Is passing mPersonToPostTo like 
this safe?
                                postDone(mPersonToPostTo);
                        }
                }

                private function postDone(Person mPerson)
                {
                        //QUESTION - Sometimes mPerson arrives as null at this 
point
                        //WHAT AM I DOING WRONG?
                }

                private function postingProgressed(Person mPerson, Integer 
value)
                {
                        //QUESTION - Sometimes mPerson arrives as null at this 
point
                        //WHAT AM I DOING WRONG?
                }
        }

Thanks a ton for your valuable guidance!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en

Reply via email to