jskubick

jskubick

Kotlin and Android Development featuring Jetpack: omitted change for bottomNav val (page 190)

I’m not sure whether I just overlooked it somewhere prior to page 190, but when I got to page 190 and added the code at the bottom of the page to create AppBarConfiguration(bottomNav.menu), I got an error because bottomNav was never defined.

After comparing my MainActivity.kt to the one from chapter 7 of the zipfile, I noticed that the zipfile changed

findViewById<BottomNavigationView>(R.id.bottom_nav).setupWithNavController(this.navController)

to

val bottomNav = findViewById<BottomNavigationView>(R.id.bottom_nav) bottomNav.setupWithNavController(this.navController)

It’s entirely possible you mentioned it earlier in the book & I just overlooked it. (Sigh… I wish publishers would bundle codes for free copies of the ebook with printed copies, or work out something with Amazon like, “buy the printed book, immediately get the Kindle version free”. Ebooks suck for actual reading, but they occasionally come in handy as super-indexes that can be brute-force searched for situations like this.)


I also noticed a minor issue with the way the penny_drop_created_by entry in strings.xml is encoded… the double quotes around the book’s title need to be backslash-escaped, or they won’t be printed:

<string name="penny_drop_created_by">The <i>Penny Drop</i> app was created by Michael Fazio for the Pragmatic Bookshelf title <a href="https://pragprog.com/titles/mfjetpack/">\"Kotlin and Android Development featuring Jetpack\"</a>.</string>

As an aside, for your own future projects, you might want to check out https://noties.io/Markwon as a convenient alternative to SpannableString. I discovered it a few months ago & totally fell in love with it :icon_cool:

First Post!

mfazio23

mfazio23

Author of Kotlin and Android Development featuring Jetpack

Jeff, don’t worry on this one, you’re correct. I forgot to include it in the text.

As far as the strings.xml update, you’re correct. I think I missed it due to the link highlighting.

Also, Markwon looks way nicer, and I’m always in favor of using Markdown syntax!

Where Next?

Popular Pragmatic Bookshelf topics Top

alanq
This isn’t directly about the book contents so maybe not the right forum…but in some of the code apps (e.g. turbo/06) it sends a TURBO_ST...
New
swlaschin
The book has the same “Problem space/Solution space” diagram on page 18 as is on page 17. The correct Problem/Solution space diagrams ar...
New
adamwoolhether
When trying to generate the protobuf .go file, I receive this error: Unknown flag: --go_opt libprotoc 3.12.3 MacOS 11.3.1 Googling ...
New
jskubick
I think I might have found a problem involving SwitchCompat, thumbTint, and trackTint. As entered, the SwitchCompat changes color to hol...
New
jskubick
I found an issue in Chapter 7 regarding android:backgroundTint vs app:backgroundTint. How to replicate: load chapter-7 from zipfile i...
New
akraut
The markup used to display the uploaded image results in a Phoenix.LiveView.HTMLTokenizer.ParseError error. lib/pento_web/live/product_l...
New
Henrai
Hi, I’m working on the Chapter 8 of the book. After I add add the point_offset, I’m still able to see acne: In the image above, I re...
New
a.zampa
@mfazio23 I’m following the indications of the book and arriver ad chapter 10, but the app cannot be compiled due to an error in the Bas...
New
New
dachristenson
I’ve got to the end of Ch. 11, and the app runs, with all tabs displaying what they should – at first. After switching around between St...
New

Other popular topics Top

Devtalk
Hello Devtalk World! Please let us know a little about who you are and where you’re from :nerd_face:
New
ohm
Which, if any, games do you play? On what platform? I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
New
New
AstonJ
You might be thinking we should just ask who’s not using VSCode :joy: however there are some new additions in the space that might give V...
New
Rainer
My first contact with Erlang was about 2 years ago when I used RabbitMQ, which is written in Erlang, for my job. This made me curious and...
New
AstonJ
poll poll Be sure to check out @Dusty’s article posted here: An Introduction to Alternative Keyboard Layouts It’s one of the best write-...
New
AstonJ
Was just curious to see if any were around, found this one: I got 51/100: Not sure if it was meant to buy I am sure at times the b...
New
AstonJ
If you want a quick and easy way to block any website on your Mac using Little Snitch simply… File &gt; New Rule: And select Deny, O...
New
PragmaticBookshelf
Author Spotlight: Sophie DeBenedetto @SophieDeBenedetto The days of the traditional request-response web application are long gone, b...
New
AnfaengerAlex
Hello, I’m a beginner in Android development and I’m facing an issue with my project setup. In my build.gradle.kts file, I have the foll...
New

Sub Categories: