First of all, great book. At times, I have had to re-read some chapters to get a good grasp on things, but overall, it has been easy to follow and rewarding so far.
With that said, I have also done some iOS development (picked it up last summer using the Big Nerd Ranch iOS book). I am wondering if this is a common opinion, but does it seem like to anyone else that Android programming requires more than just a few extra lines to solve the same “problem” that you would be solving in Objective C for iOS? I am not trying to sound like a fanboy or be a troll in any way. I briefly looked through this board and did not find a similar topic, and so I thought I would go ahead and post this…
For example, to create a dialog (chapter that goes over implementing the DatePicker in the CriminalIntent app)- I had to create an XML file as well as a Fragment class. Now granted that there was extra code required because a datepicker had to be implemented in the dialog (and likewise, I would create a subclass of UIAlertView and draw a date picker or go some completely other route), it still strikes me that in order to create a dialog with two buttons, I would still have to create a new class. Perhaps there’s a short cut for this or is the solution presented in the book the best route?
I suppose a shortcut would be to add additional arguments to the “newInstance” method for the fragment class that returns the dialog, and use these args to control what text to show and what to label the buttons, etc. That way the same class can be used over and over again throughout a project. It just blows my mind that there wouldn’t be an easier API call (or perhaps I am looking at this all wrong? Can someone please enlighten me?)
Another issue I have is with organization of my project. I believe in Chapter 16, it is stated that you cannot add your files at the root level in the res directory (okay, fair enough), but also that you cannot create subdirectories (for example, subdirectories in res/values or res/layout, etc.) Let’s say I am building a pretty large application for an enterprise. How do I keep my project organized? Prefixing activity_ or dialog_ doesn’t sound like a good solution in that case. Is this going to change in coming versions of Android or with the Android Studio?
Moving on, the book talks about MVC in one of the first initial chapters. However, I am at Chapter 16 at this point, and no concept of organizing the models and controllers into separate folders of packages has been presented. Is that a norm when it comes to Android development, or did the authors purposely skip this in order to just focus on the code itself?
Next question - is the Activity alone considered the controller, or both Activity+Fragment (assuming the activity uses fragments)? I am guessing the latter, but I just want to be sure…
Lastly, is there a best practice for separating the activities from fragments themselves in terms of the project structure, or should they all just be thrown in the same package or folder? Actually, I can’t stress this point enough. While the book itself contains solid information, the fact that it left out this discussion really irritates me. I understand fragments are used extensively in this book in order to get the idea across (their benefits - flexibility, re-usability, etc), but the files all cluttered together makes the reader confused… I’ve probably ended up spending more time trying to get a grasp of where I am (what file it is I am looking at and what file does what) as I followed through the book step-by-step instead of on the actual lines of code and API calls themselves.
Anyway, hope I can get some of these questions answered. And please don’t be offended by my critiques. It’s a great book overall.