-1
I’m new in the area and had made a currency converter application in Kotlin and wanted to put a API, but I am unable to start the application because of this error in the onCreate
. I have tried to create a function with the code and call it in onCreate
, but ask for a parameter when I do that.
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?, dolarResult: DolarResult) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val btCalcular = btnCalculator
btCalcular.setOnClickListener {
val calculo = Integer.parseInt(txtWrite.text.toString())
fun HideKeyboard() {
val imm = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
if (imm.isActive) imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0)
}
HideKeyboard()
val bid = dolarResult.bid
val resultado = calculo * bid
val textofinal = "O valor de R$$calculo em USD é $$resultado"
textView.text = textofinal
}
}
}
what error you are receiving?
– rLinhares
" 'onCreate' overrides Nothing"
– Calebe Luis