trubesv
08/26/2017, 7:20 PMCoroutine
that is inside a custom ViewHolder
The function is not recognised, and when I put it in the ViewHolder
class, of course I can't calll the `add`/`remove` functions anymore..
Could you point me in the right direction please?
Here is the basic setup:
class MyAdapter() : RecyclerView.Adapter<MyViewHolder>()
{
[...]
/* Custom ViewHolder */
class MyViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)
{
fun bind(item: Item) = with(itemView)
{
/* Handle long click event on row*/
isLongClickable = true
onLongClick { function() } // I'M HAVING TROUBLE HERE (Unresolved reference)
[...]
}
}
/* How to call this? */
fun function() {
add()
remove()
}
/* MyAdapter functions */
fun add() {}
fun remove() {}
Thanks for the help! 🙂
Slack Conversationenighma
08/29/2017, 9:25 PM{
-brace being on it’s separate line?