I am doing a lisview in andadroid studio with kotlin, but when I create the setOnItemClickListene, it shows me that parent, view, and id Parameteris never used could be renamed to_, I don’t understand why I get this warning in my code. What should I do to remove this warning?
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val listapaises = arrayOf(
"Colombia", "Argentina",
"Ecuador", "Venezuela",
"Brasil", "Paraguay", "Uruguay",
"Bolivia", "Peru", "Chile"
)
val habitantes = arrayOf(
40_000_000, 17_000_000,
6_500_000, 10_000_000,
30_000_000, 14_000_000,
183_000_000, 44_000_000,
31_000_000, 3_500_000
)
val adaptador1 =
ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, listapaises)
lv_lista.adapter = adaptador1
lv_lista.setOnItemClickListener { _, _, position, _ -> tv_resultado.text = ("Total habitantes ${habitantes[position]}")
}
}
}