Wrox Programmer Forums
|
BOOK: Beginning Android Programming with Android Studio, Fourth Edition
This is the forum to discuss the Wrox book Beginning Android Programming with Android Studio, Fourth Edition by Jerome F. DiMarzio; ISBN: 978-1-118-70559-9
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Android Programming with Android Studio, Fourth Edition 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
 
Old April 6th, 2017, 09:15 PM
Registered User
 
Join Date: Apr 2017
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Slight Clarification Needed on Page 54


Hello all!

I just bought the Beginning Android Programming with Android Studio, Fourth Edition yesterday, and so far I am enjoying the book! However, I knew something had to be wrong when I attempted to add a theme to an activity as the book mentions on page 54. Consistently when I attempted to edit the android:theme line and debug the program, I would get a fatal error stating that I must use a theme from the AppCompat library.

Being relatively new to Android programming I had no idea what was causing this error. I ended up creating a new project, but noticed the the Backwards Compatibility (AppCompat) option was selected by default when creating a new project. Once I created a new project without that option, the themes loaded without issue.

Do any of you know why deselecting this option worked? And in future revisions, would it be possible to add this as a side note before you have a reader try adding a theme?

 
Old April 6th, 2017, 09:32 PM
Registered User
 
Join Date: Apr 2017
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Additional details for clarification:

- Using Nexus 5X API 24 Android 7.0 Emulator

- When trying to add the Material Theme (dark) to Activity101, running the program in debugging mode causes the app to stop in the emulator. In the Android Monitor, the error in red states:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.activity101/com.example.activity101.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.


- When trying to hide the Title Bar in Activity101, running the program in debugging mode causes the app to stop in the emulator. In the Android Monitor, the error in red states:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.activity101_5/com.example.activity101_5.MainActivity}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content.

 
Old May 29th, 2017, 12:38 AM
Registered User
 
Join Date: May 2017
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

went through the same mess with the first few examples trying to import the sample projects. gave up and have just been creating new projects and copying all the code manually. good exercise in the long run i suppose. but yeah, future editions should be mindful of this and include the steps necessary to make the sample projects run on the latest versions of everything. too frustrating for someone new to Android Studio to try and figure out on their own.





Similar Threads
Thread Thread Starter Forum Replies Last Post
chapter2, page 54, code doesn't work. celviano BOOK: Beginning Android 4 Application Development 0 July 15th, 2013 08:58 PM
Ch23 Page 499 - Clarification please ken evans BOOK: Professional Visual Studio 2010 3 December 12th, 2010 09:42 AM
Page 54: exec command rarely used? buckersher BOOK Beginning Linux Programming, 3rd Edition 0 September 27th, 2006 09:56 AM





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