Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2
This is the forum to discuss the Wrox book Professional Android Application Development by Reto Meier; ISBN: 9780470344712
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old December 30th, 2008, 03:36 PM
Registered User
 
Join Date: Dec 2008
Location: Alameda, CA USA
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Chapter 2 -- To Do List -- when to use super.onCreate(icicle);?

Eclipse sets up a new Android project with onCreate and includes super.onCreate(savedInstance) as the first line. I see this in the sample code I downloaded, but don't see it on page 40 of the book.

Without this line, the debugger throws a "source not found" error.

My question is, Where is onCreate that we are overriding? and why do we need to do this (was this supposed to be included in page 40)?

thanks.
  #2 (permalink)  
Old December 30th, 2008, 07:37 PM
Registered User
 
Join Date: Dec 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm getting the same error. What is the problem?
  #3 (permalink)  
Old December 31st, 2008, 03:37 AM
Reto's Avatar
Wrox Author
Points: 287, Level: 5
Points: 287, Level: 5 Points: 287, Level: 5 Points: 287, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2008
Location: London, United Kingdom
Posts: 61
Thanks: 1
Thanked 7 Times in 6 Posts
Default

Quote:
Originally Posted by SteveOliverC View Post
My question is, Where is onCreate that we are overriding? and why do we need to do this (was this supposed to be included in page 40)?
Apologies! Yes, it looks like the super.onCreate(icicle) line somehow got dropped from the text on page 40 -- you always need to call super.OnCreate when overriding the onCreate method of an Activity. It should be the first thing called in the overriding method.

The correct technique for overriding onCreate is shown on page 66, or as you point out, in the downloadable code samples.

Sorry again for the confusion, not sure how that snuck through.
__________________
Reto Meier

Author, "Professional Android 4 Application Development", Wrox, ©2012, 2010, 2008
@retomeier
The Following User Says Thank You to Reto For This Useful Post:
SteveOliverC (December 31st, 2008)
  #4 (permalink)  
Old December 31st, 2008, 11:27 AM
Registered User
 
Join Date: Dec 2008
Location: Alameda, CA USA
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

No worries! and thanks for the quick reply and clarification. I'm really enjoying the book and I am very impressed with the quality (especially considering how quickly the book came to market).
  #5 (permalink)  
Old December 31st, 2008, 11:58 AM
Registered User
 
Join Date: Dec 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just one more question about icicle. What is icicle and why do I change savedInstance to icicle?

I also agree this book is fantastic. Thank you.
  #6 (permalink)  
Old January 1st, 2009, 01:49 PM
Reto's Avatar
Wrox Author
Points: 287, Level: 5
Points: 287, Level: 5 Points: 287, Level: 5 Points: 287, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2008
Location: London, United Kingdom
Posts: 61
Thanks: 1
Thanked 7 Times in 6 Posts
Default

'icicle' is what earlier versions of the SDK used to name the Bundle objects that got passed in to the onCreate method. The new SDK defaults the name to savedInstanceState. I've used them interchangeably, but for consistency it's probably easiest to stick with savedInstanceStatein your own projects.

It's great to hear you guys are finding the book useful, thanks for the kind words.
__________________
Reto Meier

Author, "Professional Android 4 Application Development", Wrox, ©2012, 2010, 2008
@retomeier
  #7 (permalink)  
Old January 5th, 2009, 10:42 PM
Registered User
 
Join Date: Jan 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Worked for me...

The eclipse plugin automatically inserted that line for me and I guess I didn't even notice since I had already seen it in other examples. I was wondering about the random use of the term icicle however so thanks for the clarification.


Similar Threads
Thread Thread Starter Forum Replies Last Post
'super' keyword ?! nerssi Javascript 0 February 14th, 2008 08:17 AM
Invoke Events that were declated in a super class Aaron Edwards ASP.NET 2.0 Professional 1 January 2nd, 2008 03:59 PM
Chapter 7 - List Views Not Refreshing VBNovice BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 3 January 31st, 2007 08:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.