Answers for "android popup menu kotlin"

0

android popup menu kotlin

val popupMenu: PopupMenu = PopupMenu(this,button)  
           popupMenu.menuInflater.inflate(R.menu.popup_menu,popupMenu.menu)  
           popupMenu.setOnMenuItemClickListener(PopupMenu.OnMenuItemClickListener { item ->  
                    when(item.itemId) {  
                    R.id.action_crick ->  
                        Toast.makeText(this@MainActivity, "You Clicked : " + item.title, Toast.LENGTH_SHORT).show()  
                    R.id.action_ftbal ->  
                        Toast.makeText(this@MainActivity, "You Clicked : " + item.title, Toast.LENGTH_SHORT).show()  
                    R.id.action_hockey ->  
                        Toast.makeText(this@MainActivity, "You Clicked : " + item.title, Toast.LENGTH_SHORT).show()  
                }  
                true  
           })  
           popupMenu.show()
Posted by: Guest on December-16-2020

Browse Popular Code Answers by Language