Actually this method consists in dynamically changing the options menu. To create multiple context menus, you must define them in your onCreateContextMenu method. As you can see, this method receives the View as parameter, which is the View you clicked on to display the menu. This way you save the method that you have for your ListView , and you add some conditions to distinguish your Views . Then you use these conditions to create the desired Context Menu .
Note. Context menus do not support icons, so if you need icons, images, or something similar, you will either have to use the options menu that you dynamically change, or create your own menu using a custom view, intent, and all that.
source share