2

Menu is defined like this:

<item
            android:id="@+id/nav_slideshow"
            android:icon="@drawable/ic_menu_slideshow"
            android:title="@string/menu_slideshow"
            app:actionViewClass="android.widget.CheckBox"/>

I need to know android:icon value as provided in xml. There is a method getIcon() but it returns Drawabe object. How to get resource id as int?

[edit] Not a duplicate, solution proposed as possible answer is unrelated.

user1209216
  • 7,404
  • 12
  • 60
  • 123

1 Answers1

0

As I know, there is no way to get resource ID of a already retrieved resource. But if it helps, you can get its ID by its name. You can read how to do it here

Amin Mousavi
  • 1,220
  • 10
  • 21