hanafey (18) [Avatar] Offline
#1
<QUOTE p 196>>>Marking an input parameter as ‘in’ is similar to marking it as final in Java.<<<QUOTE>

Of course "final" is nothing like "in" so this comparison is really just confusing (at least confusing only to the Java novice).
Joachim Rohde (2) [Avatar] Offline
#2
Re: Errors and Corrections
On page 22 you mention that you'll talk about SQLite in chapter 6 but actually it's chapter 7.
charlie.collins (125) [Avatar] Offline
#3
Re: Errors and Corrections
Whoops, thanks for letting us know. I'll get that in the next update.
icogs (16) [Avatar] Offline
#4
Re: Errors and Corrections
Page 48: Listing 2.10: Constructor for DealsAdapter creates a local ArrayList<Item> rather than have it passed in as Listing 2.5 demands. Does it even make sense to use a local list, how would you set the content? The downloaded source code seems to be fine.
charlie.collins (125) [Avatar] Offline
#5
Re: Errors and Corrections
Yep, you're exactly right. That's an old version of the adapter in the book, where we used to add each item later after costruction. The refactored approach passes in the items at construction. I'll get the listing fixed. Thanks for noting this.
kuba.zygmunt (2) [Avatar] Offline
#6
Re: Errors and Corrections
Listing 3.2 on page 70:

enableNotification should be initialized with default value: true
private boolean enableNotifications = true;
mkneissl (1) [Avatar] Offline
#7
Re: Errors and Corrections
On pg 157 (message passing) you create messages with "new Message()". This might lead to memory leaks. Better use "Message.obtainMessage" or one of the other obtainMessage methods.
matthias.kaeppler (8) [Avatar] Offline
#8
Re: Errors and Corrections
Hi,

as far as I know, using 'new' will not create a memory leak or even risk creating one. It simply means that it will create a new message instance instead of re-using one from the global message pool. If no message instance would be available in the pool, then Android would create one using 'new'.

You raise a good point though, since it's always encouraged to re-use objects where possible. I will change any 'new' statements to Message.obtain.

Thanks!
matthias.kaeppler (8) [Avatar] Offline
#9
Re: Errors and Corrections
A reader had a few issues with the sample apps, and posted them in an Amazon review here:

http://www.amazon.de/product-reviews/1935182927
ElGoog (1) [Avatar] Offline
#10
Re: Errors and Corrections
Hello there,

thank you for this great book. And I mean it. And judging from what can be found on popular forums, quite a few people would benefit from it. I'm glad I came across a recommendation.

Looking at technique 25, I had the following thoughts.

The implementation of the Worker in listing 6.9 relies on the assignment operations for this.context being atomic, if I'm not mistaken. This synchronization aspect might be worth mentioning. And would it hurt declaring this.context volatile?

The WorkerActivity in listing 6.8, in the case of a new Worker, connects the Worker with the Activity only after it calls worker.execute(). I have not yet found any hints that Activity.onCreate() is executed in an atomic fashion. Quite to the contrary, I have seen systems (although not Java Thread based) which immediately prefer newly created threds. That would mean that the Worker may run or even, in rare cases, finish before the WorkerActivity connects to it. Maybe I'm missing something but I wouldn't take the risk?

Thank you, and keep up the excellent work!
lsag64 (3) [Avatar] Offline
#11
Re: Errors and Corrections
all these corrections seems not to match the printed book (Android in Practice, 2011, ISBN 9781935182924), as i showed here: http://www.manning-sandbox.com/thread.jspa?threadID=58425&tstart=0

are there any news for an errata of the actual book?

many thanks, bye

Message was edited by:
lsag64