I want to start a ringtone as soon as a specific condition is true. Exactly in a Viewholder class in a Fragment. In this class some data from a database are given to some textfields. Is a condition in this routine is true then a ringtone should be played. F.i.
class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
fun bind(cryptoData: CryptoData, listener: Listener, icons: Array<Int>, position: Int) {
itemView.setOnClickListener { listener.onItemClick(cryptoData) }
itemView.icon_view.setImageResource(icons[position])
itemView.text_name.text = cryptoData.name
itemView.text_price.text = getPricesString(cryptoData.prices)
val priceLimit = 6000.0
val priceEuro = getPricesString(cryptoData.prices).toFloat()
if(priceEuro > priceLimit){
// ringtone should start here !!!
}
}
Many thanks for your answers best regards Peter