p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 (http://p2p.wrox.com/forumdisplay.php?f=432)
-   -   Code not going as planned: "icicle" vs "savedinstancestate" (http://p2p.wrox.com/showthread.php?t=73070)

joopthecat March 4th, 2009 11:45 AM

Code not going as planned: "icicle" vs "savedinstancestate"

I am new to the eclipse platform, and I haven't programmed in quite some time (have some experience in Visual Basic and C). Not sure if this problem is related to the dev-environment or specific Java SDK I'm using.

But in Chapter 2, the Hello World program, I have followed all prior steps in the book, except that the code that the JDT automatically fills in has the lines:

----public void onCreate(Bundle savedInstanceState) et. al----

whereas the book describes that the same line should have been:

----public void onCreate(Bundle icicle) et. al----

Why is this? Where does this discrepancy arise from and has no one else experienced this? It's a minor discrepancy, but I am wondering if this is only the beginning of a slough of problems I may eventually have to overcome.

I am using
Eclipse Ganymede 3.4.2 build M20090211-1700
Android SDK 1.1 r1
JDK 6 u12

There is another issue which I will post in another thread.

Reto March 4th, 2009 11:53 AM

What you're seeing shouldn't cause any problems, it's a hold-over from an earlier release of the SDK which defaulted the parameter name in the onCreate method to 'icicle' rather then 'savedInstanceState'.

Given that what's changed is just the parameter name (rather than the class -- Bundle -- being passed in) you can use either name, as long as you use it consistently if you access it within that method.

Hopefully that's one of the few inconsistencies you'll find, but if you do spot any other problems I'll be more than happy to try and help solve them.

joopthecat March 5th, 2009 11:49 AM

Thank you very much, Mr. Meier, for this and your reply to my other posted question. As far as this particular subject is concerned, I suppose I would need to keep abreast of all future changes, minor or not, so as to avoid confusion.

peterkirn May 3rd, 2009 03:09 PM

Ha! I was confused about that, too. (savedInstanceState, of course, being far more intuitive than the wintry wonderland Christmas spirit of icicle.)

Maybe not really an errata as the other code will work, but worth an official note?

Were there other terminology changes in the lifecycle stuff of which we should be aware?

All times are GMT -4. The time now is 04:08 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.