Issue
I have learned the java basics and am now trying to make an android app for my phone. I was doing fine up until I started using variables in android studio. Im fairly sure variables are meant to be declared like
var/val varName:Boolean false;
But whenever I do this I get an error saying "Cannot resolve symbol var".
I have researched but I cannot find any reason this is happening and no matter where I put this line of code it does not work. Everywhere I found online seems to say I'm doing it right but it doesn't work. I would love any adviceor how to make it work. Thanks
Solution
This post is kinda confusing, in what language are you creating the app, java or kotlin? the syntax looks like Kotlin, but you are stating that you know Java basics (nothing said about kotlin)
Anyways, In kotlin, in order to create a variable you would do something like:
val a: Int = 1 // this is a VALUE, you cannot change the value of "val"
val b = 2 // this is also a value
var c = 2 // this is a variable, you can change the value of c
c = 5 // like I did here
var name: Boolean = false // and that's what I think you've tried to do
Answered By - JustSightseeing
Answer Checked By - Candace Johnson (JavaFixing Volunteer)