Got an error:None of the following functions can be called with the arguments supplied

Viewed 20

I am fairly new with coding,I just followed a tutorial but it seems it doesnt work for me.

The error says: None of the following functions can be called with the arguments supplied.

makeText(context: Context!, text: CharSequence!, duration: Int)defined in android.widget.Toast

makeText(context: Context!, resId: Int, duration: Int): Toast! defined in android.widget.Toast

This is my code:

override fun View.OnClick(v: View) {
    when (v.id) {

        R.id.Jawaban_A -> {
            selectedOptionView(Jawaban_A, 1)
        }

        R.id.Jawaban_B -> {
            selectedOptionView(Jawaban_B, 2)
        }

        R.id.Jawaban_C -> {
            selectedOptionView(Jawaban_C, 3)
        }

        R.id.Jawaban_D -> {
            selectedOptionView(Jawaban_D, 4)
        }

        R.id.btn_jawab -> {
            if (mSelectedOptionPosition == 0) {
                 mCurrentPosition++

                when {
                    mCurrentPosition <= mQuestionlist!!.size ->{
                        setQuestion()
                    }else -> {
                    Toast.makeText(this,
                    "Anda berhasil mengerjakan quiz", Toast.LENGTH_SHORT).show()
                    }
                }

            }

        }

    }

}
0 Answers
Related