I have this code, this works perfect. Only i want to make this dynamic without the xml file(actions.xml). How do i do that?
public void showPopup(View v) {
PopupMenu popup = new PopupMenu(this, v);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.actions, popup.getMenu());
popup.show();
}
Use
popup.getMenu()and then add items directly using the various overloads ofadd.