
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
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 calledna
(with the value “N/A”).
Popular Prag Prog topics










Other popular topics









Latest in PragProg
Latest (all)
Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /js
- /rails
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /opensuse
- /ash
- /centos
- /php
- /deepseek
- /scala
- /zig
- /html
- /debian
- /nixos
- /lisp
- /agda
- /sublime-text
- /textmate
- /react-native
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /manjaro
- /spring
- /django
- /diversity
- /nodejs
- /lua
- /slackware
- /c
- /julia
- /neovim