Mistakes in this chapter


#1

Hi!

I’m starting a topic where all found mistakes should go.
(I reported them to your facebook accoutnt, but the guy, who manages it, said that it is better to report mistakes directly here)

Here is the first one for this chapter:

<< Listing 9.4 “Adding … to the new activity”. >>
Listing says “activity”, but it should really say “fragment”. From what I understood previously and your awesome book: fragment is not an activity. Also I checked stackoverflow: stackoverflow.com/questions/7703 … ty-android , so it seems that I’m correct.


#2

Hi All,

I’ve found another issue so far that couldn’t finding it anywhere until I got to the Chapter 12.
It’s on the Chapter 9 >> Listing 9.3: Generating Crimes (CrimeLab.java)

On the following code…

for (int i = 0; i < 100; i++) {
            Crime c = new Crime();
            c.setTitle("Crime #" + i);
            c.setSolved(i % 2 == 0); // Every other one
            mCrimes.add(c);
        }

You will need to add the following line because otherwise the app will crash with nullPointExceptions… as the date hasn’t been created and you’re sending a null value.

c.setDate(new Date());

… So the final code will be:

for (int i = 0; i < 100; i++) {
            Crime c = new Crime();
            c.setTitle("Crime #" + i);
            c.setDate(new Date());
            c.setSolved(i % 2 == 0); // Every other one
            mCrimes.add(c);
        }

Then you can continue…


#3

You’re probably missing a line from Listing 8.1.


#4

Thanks egmweb! You’ve probably saved me about 3 days of debugging


#5

[quote=“Nyancat”]Hi!

I’m starting a topic where all found mistakes should go.
(I reported them to your facebook accoutnt, but the guy, who manages it, said that it is better to report mistakes directly here)

Here is the first one for this chapter:

<< Listing 9.4 “Adding … to the new activity”. >>
Listing says “activity”, but it should really say “fragment”. From what I understood previously and your awesome book: fragment is not an activity. Also I checked stackoverflow: stackoverflow.com/questions/7703 … ty-android , so it seems that I’m correct.[/quote]

The Kindle version is okay. It says: [quote]Listing 9.4 Adding onCreate( Bundle) to the new fragment[/quote]