CodeMonkey
CodeMonkey

Reputation: 12424

Android - have the same id to 2 different menu items on 2 different menus

I got 2 menus which are almost the same except for the title in a single item. I noticed that Eclipse allow me to compile these menus even though the parallel items in both menus got the same ID.

Is it safe to use menus like that meaning have something like this code on 2 different places:

case R.id.menuitem1:  ...
case R.id.menuitem2:  ...

Upvotes: 0

Views: 244

Answers (1)

user2520215
user2520215

Reputation: 653

Yes, it is safe. Though it is always a better practice to not have same ids as a practice.

Upvotes: 1

Related Questions