android - How can I complete my constructor? -
i have code:
override fun oncreateoptionsmenu(menu: menu): boolean { menuinflater.inflate(r.menu.menu_search, menu) val searchitem = menu.finditem(r.id.action_search) val searchview = menuitemcompat.getactionview(searchitem) searchview //*** setonquerytextfocuschangelistener *** searchview.setonquerytextfocuschangelistener(object : view.onfocuschangelistener() { override fun onfocuschange(v: view, hasfocus: boolean) { } }) searchview.setonquerytextlistener(object : searchview.onquerytextlistener { override fun onquerytextsubmit(query: string): boolean { return false } override fun onquerytextchange(searchquery: string): boolean { adapter!!.filter(searchquery.tostring().trim { <= ' ' }) tvlistanimal.invalidate() return true } }) return true }
the problem comes part:
searchview.setonquerytextfocuschangelistener(object : view.onfocuschangelistener() { override fun onfocuschange(v: view, hasfocus: boolean) { } })
when try run android studio, message:
'this class not have constructor.'
i try write this:
searchview.setonquerytextfocuschangelistener(object : view.onfocuschangelistener { override fun onfocuschange(v: view, hasfocus: boolean) { } })
it works app crashes, because remove parenthesis after view.onfocuschangelistener
.
i have no idea how complete this. has idea?
Comments
Post a Comment