I need to save a pressed button id the first time the app is executed. I have an Activity with two buttons that take you to one new activity (there are 2 profiles,like user and supervisor). I would like to save button id the first time that my app is running on the device, so in next executions you don't need to select the profile again. Is that possible?
This is my SelectionActivity code:
class SeleccionarPerfilActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_seleccionar_perfil)
val btnHijo: Button = findViewById(R.id.botonhijo)
val btnTutor: Button = findViewById(R.id.botonmadre)
btnHijo.setOnClickListener{onClick(btnHijo.id}
btnTutor.setOnClickListener{onClick(btnTutor.id}
}
fun onClick(id:Int) {
when(id){
R.id.btnHijo-> {
val intent=Intent(this,MenuHijoActivity::class.java)
startActivity(intent)
}
R.id.btnTutor-> {
val intent=Intent(this,MenuTutorActivity::class.java)
startActivity(intent)
}
}
}