Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 6th, 2017, 09:15 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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?

Reply With Quote
  #2 (permalink)  
Old April 6th, 2017, 09:32 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.

Reply With Quote
  #3 (permalink)  
Old May 29th, 2017, 12:38 AM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 08:42 AM
Page 54: exec command rarely used? buckersher BOOK Beginning Linux Programming, 3rd Edition 0 September 27th, 2006 09:56 AM



All times are GMT -4. The time now is 01:26 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.