keno.basedow

keno.basedow

Kotlin and Android Development featuring Jetpack: @string/na error (version B4.0 page 91)

Hi Michael,

line

android:text=’@{vm.currentPlayer.playerName ?? @string/na}’

produces error

…\PennyDrop\app\build\generated\source\kapt\debug\de\basedow\keno\pennydrop\databinding\FragmentGameBindingImpl.java:503: error: cannot find symbol
vmCurrentPlayerPlayerNameJavaLangObjectNullTextCurrentPlayerNameAndroidStringNaVmCurrentPlayerPlayerName = ((vmCurrentPlayerPlayerNameJavaLangObjectNull) ? (textCurrentPlayerName.getResources().getString(R.string.na)) : (vmCurrentPlayerPlayerName));
^
symbol: variable na
location: class string

i replaced it by

android:text=’@{vm.currentPlayer.playerName ?? “”}’

Kind regards Keno

Marked As Solved

mfazio23

mfazio23

Author of Kotlin and Android Development featuring Jetpack

Thanks Keno - this one isn’t actually an error since I mention the fallback resource value. However, I wasn’t super clear on what I meant there, so I’ve included an extra note about what exactly to add:

In case we don’t have a value for currentPlayer (like before a game’s been started), we’re also going to add a fallback string resource value called na (with the value “N/A”).

Popular Prag Prog topics Top

New
iPaul
page 37 ANTLRInputStream input = new ANTLRInputStream(is); as of ANTLR 4 .8 should be: CharStream stream = CharStreams.fromStream(i...
New
johnp
Running the examples in chapter 5 c under pytest 5.4.1 causes an AttributeError: ‘module’ object has no attribute ‘config’. In particula...
New
ianwillie
Hello Brian, I have some problems with running the code in your book. I like the style of the book very much and I have learnt a lot as...
New
conradwt
First, the code resources: Page 237: rumbl_umbrella/apps/rumbl/mix.exs Note: That this file is missing. Page 238: rumbl_umbrella/app...
New
rmurray10127
Title: Intuitive Python: docker run… denied error (page 2) Attempted to run the docker command in both CLI and Powershell PS C:\Users\r...
New
Chrichton
Dear Sophie. I tried to do the “Authorization” exercise and have two questions: When trying to plug in an email-service, I found the ...
New
jskubick
I’m running Android Studio “Arctic Fox” 2020.3.1 Patch 2, and I’m embarrassed to admit that I only made it to page 8 before running into ...
New
fynn
This is as much a suggestion as a question, as a note for others. Locally the SGP30 wasn’t available, so I ordered a SGP40. On page 53, ...
New
taguniversalmachine
Hi, I am getting an error I cannot figure out on my test. I have what I think is the exact code from the book, other than I changed “us...
New

Other popular topics Top

New
AstonJ
Thanks to @foxtrottwist’s and @Tomas’s posts in this thread: Poll: Which code editor do you use? I bought Onivim! :nerd_face: https://on...
New
Exadra37
On modern versions of macOS, you simply can’t power on your computer, launch a text editor or eBook reader, and write or read, without a ...
New
DevotionGeo
The V Programming Language Simple language for building maintainable programs V is already mentioned couple of times in the forum, but I...
New
PragmaticBookshelf
Rails 7 completely redefines what it means to produce fantastic user experiences and provides a way to achieve all the benefits of single...
New
PragmaticBookshelf
Author Spotlight Rebecca Skinner @RebeccaSkinner Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New
New
First poster: bot
Large Language Models like ChatGPT say The Darnedest Things. The Errors They MakeWhy We Need to Document Them, and What We Have Decided ...
New
PragmaticBookshelf
Author Spotlight: Sophie DeBenedetto @SophieDeBenedetto The days of the traditional request-response web application are long gone, b...
New
PragmaticBookshelf
A Ruby-Centric Chat with Noel Rappin @noelrappin Once you start noodling around with Ruby you quickly figure out, as Noel Rappi...
New

Latest in PragProg

View all threads ❯