Two validates at the same time

Asked

Viewed 9 times

0

Good afternoon guys! My products have two expiration dates at the same time. How can I register these dates using different buttons. android studio is not accepting two "override fun onDateSet" at the same time:

Hug!

open class RegisterActivity : AppCompatActivity(), View.OnClickListener , DatePickerDialog.OnDateSetListener{
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_register)
 
        button_back.setOnClickListener(this)
        button_level2.setOnClickListener(this)
        button_level3.setOnClickListener(this)
 
    }
    override fun onClick(view: View) {
        val id = view.id
        if (id == R.id.button_back) {
            startActivity(Intent(this, MainActivity::class.java))
        }
 
        val id2 = view.id
        if (id2 == R.id.button_level2) {
            DatePickerDialog(this, this, 2021, 1, 1).show()
 
        val id3=view.id
        if (id3==R.id.button_level3){
            DatePickerDialog(this,this,2021,2,1).show()
 
        }
 
 
    }
 
    }
 
    override fun onDateSet(view: DatePicker, year: Int, month: Int, dayOfMonth: Int) {
        button_level2.text="$dayOfMonth/$month/$year"
    }
    override fun onDateSet(view: DatePicker, year: Int, month: Int, dayOfMonth: Int) {
        button_level3.text="$dayOfMonth/$month/$year"
 
}
}
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.