[android-developers] Question on Shelves example

2010-10-21 Thread Prakash Iyer
The reference article on Painless Threading pointed me to the Shelves
example as a place to understand AsyncTask. So I was reading that example.
One question popped into my head while I was going thru ShelvesActivity. The
onPause code calls stopBooksUpdater. That code snippet is as follows,

private void stopBooksUpdater() {
final BooksUpdater booksUpdater = mBooksUpdater;
booksUpdater.clear();
booksUpdater.stop();
}

What's the reason for a local final variable which is manipulated as opposed
to the member variable? This happens in one more place but in others the
member variable is directly accessed, e.g. in onResume.

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

Re: [android-developers] Question on Shelves example

2010-10-21 Thread Romain Guy
This was useful before the JIT was added in Android 2.2. It's a bit
faster, though in this particular case it doesn't really matter, I did
it out of habit :)

On Thu, Oct 21, 2010 at 3:45 PM, Prakash Iyer thei...@gmail.com wrote:
 The reference article on Painless Threading pointed me to the Shelves
 example as a place to understand AsyncTask. So I was reading that example.
 One question popped into my head while I was going thru ShelvesActivity. The
 onPause code calls stopBooksUpdater. That code snippet is as follows,
 private void stopBooksUpdater() {
         final BooksUpdater booksUpdater = mBooksUpdater;
         booksUpdater.clear();
         booksUpdater.stop();
 }
 What's the reason for a local final variable which is manipulated as opposed
 to the member variable? This happens in one more place but in others the
 member variable is directly accessed, e.g. in onResume.
 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



-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

-- 
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