I am using an external API for some actions. One of the method takes a list of menu(xml) items like:
----.shape(R.menu.list).---
And here is my R.menu.list
file:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/share"
android:title="Share"
android:icon="@drawable/ic_share_grey600_18dp"/>
<item android:id="@+id/upload"
android:title="Upload"
android:icon="@drawable/ic_notifications_green"/>
</menu>
The problem is that the items in this R.menu.list
file are not known. They can vary. Say I have a button, on clicking it, I may have 3 items that are needed to be passed to .shape()
method, and sometimes I may have 1 or so items. How can I achieve this.