美文网首页
kotlin adapter 调用activity 方法

kotlin adapter 调用activity 方法

作者: kot_flu | 来源:发表于2019-10-18 08:28 被阅读0次

    示例如下

    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
        }
    
    
    }
    

    相关文章

      网友评论

          本文标题:kotlin adapter 调用activity 方法

          本文链接:https://www.haomeiwen.com/subject/ysjryctx.html