简体   繁体   English

如何将菜单项与列表视图绑定

[英]How to Bind menu item with listview

在此处输入图像描述

Problem - when the user clicks on the menu refresh button(As shown in image) the list of Songs will be Updated(if any change occurs).问题 - 当用户单击菜单刷新按钮时(如图所示),歌曲列表将被更新(如果发生任何变化)。 How to Acheive this(any help is apricated)如何实现这一点(任何帮助)

override fun onOptionsItemSelected(item: MenuItem): Boolean {
        return when (item.itemId) {
            R.id.action_refresh -> {
                refreshList()
                true
            }
            else -> super.onOptionsItemSelected(item)
        }
    }

private fun refreshList() {
    // Use this method to load the songs just like you might be using the same in OnCreate currently
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM