Ad
Why Are My Email And Password Variables Coming Up As Unresolved References?
I am using kotlin to build a basic an account creation form through firebase, and for some reason my variables are not being recognized and I define them right before the portion they are used in. Any help would be appreciated, code is below
class LoginActivity: AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_login)
login_btn.setOnClickListener {
val email = email_edittext.text.toString()
val password = password_edittext.text.toString()
Log.d("Login", "Attempt login with email/pw $email/***")
}
FirebaseAuth.getInstance().signInWithEmailAndPassword(email, password)
.addOnCompleteListener()
back_textview.setOnClickListener{
finish()
}
}
}
Ad
Answer
Your variables are scoped to the lambda, so not visible outside it. Looks like you should be calling the signIn
API within the lambda as well
login_btn.setOnClickListener {
val email = email_edittext.text.toString()
val password = password_edittext.text.toString()
Log.d("Login", "Attempt login with email/pw $email/***")
FirebaseAuth.getInstance().signInWithEmailAndPassword(email, password)
.addOnCompleteListener()
}
Ad
source: stackoverflow.com
Related Questions
- → should I choose reactjs+f7 or f7+vue.js?
- → Phonegap Android write to sd card
- → Local reference jquery script in nanohttpd (Android)
- → Click to navigate on mobile devices
- → How to allow api access to android or ios app only(laravel)?
- → Access the Camera and CameraRoll on Android using React Native?
- → React native change listening port
- → What is the default unit of style in React Native?
- → Google play market autocomplete icon
- → Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `ListView`
- → Using Laravel with Genymotion
- → react native using like web-based ajax function
- → react native pdf View
Ad