kotlin adapter 调用activity 方法

2019-10-18  本文已影响0人  kot_flu

示例如下

class MyBaseAdapter(internal var context: MyActivity) : BaseAdapter() {

    fun tt() {
        context.test()
    }

    fun te() {
        context.test(5)
    }


    override fun getCount(): Int {
        return 0
    }

    override fun getItem(position: Int): Any? {
        return null
    }

    override fun getItemId(position: Int): Long {
        return 0
    }

    override fun getView(position: Int, convertView: View, parent: ViewGroup): View? {
        return null
    }


}
class MyBaseAdapter(internal var context: MyActivity) : BaseAdapter() {

    fun tt() {
        context.test()
    }

    fun te() {
        context.test(5)
    }


    override fun getCount(): Int {
        return 0
    }

    override fun getItem(position: Int): Any? {
        return null
    }

    override fun getItemId(position: Int): Long {
        return 0
    }

    override fun getView(position: Int, convertView: View, parent: ViewGroup): View? {
        return null
    }


}
上一篇下一篇

猜你喜欢

热点阅读