CrimeLab - Listing 9.1



Can anybody explain me why we have to use this line ? And its purpose ?

If we remove this line the application works too.

Thx !


I don’t have this in front of me so I’m working from memory but I think you may need it later. If it makes you feel better, take it out until it is needed. I get the impression that it’s a boilerplate thing that they do automatically.

I found the book didn’t have the best explanation of Contexts but they did expand a little on them in this forum. I think the main thing to keep in mind is that Activities are subclasses of Contexts and that Contexts are needed in a lot of interaction with OS so they are just taking an opportunity to store one away when needed later.