Kotlin Speech recognizer - val cannot be reassigned - please help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Kotlin Speech recognizer - val cannot be reassigned - please help

Hello community Based on my first question, I want to program a speech recognizer with Kotlin. (in Android Studio) Sadly I have the error, that val "progressbar" as well as "toggle button" cannot be reassigned. On stackoverflow I've found, that I need to create a new function for this, but I am not quite sure. Can you guys help me? Thank you. https://code.sololearn.com/cQ5KlnSelvUQ/?ref=app https://www.sololearn.com/post/1062872/?ref=app

28th Apr 2021, 9:09 PM
Peter
3 Answers
+ 1
Ananiya Jemberu thats unusual. Here it is: https://www.sololearn.com/post/1062872/?ref=app Hope, it works now.
30th Apr 2021, 10:12 AM
Peter
0
The post is not opening can you repost it
30th Apr 2021, 8:26 AM
Ananiya Jemberu
Ananiya Jemberu - avatar
0
Peter actually the error is clear. It's showing you have declared it some where else as immutable value you can check it by holding ctrl and clicking on the error `progressBar` maybe you defined it on another file so its better to look at your import Btw findViewById is deprecated you need to use viewbinding
2nd May 2021, 7:44 AM
Ananiya Jemberu
Ananiya Jemberu - avatar