I want to pass the value of a variable which has been initialized in one class to another class since I need that value to pass it to an API I am using for further results. Is there a way I can do that ?
class LogInScreen: AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.login_screen)
getusername = findViewById(R.id.usernameEditText)
var username = usernameEditText.text
getpass = findViewById(R.id.passEditText)
var pass = passEditText.text
}
}
I have an API in my application which generates an Id when the username and password is given to the API. I save this value in a variable :
val myId = "somevalue"
I want to access the value of myId in another class. The value is needed since I want to concatenate it to the other APIs I use in my application. How can I achieve this?