我使用以下來定義組固定的常量枚舉不能用於固定常量?
private enum MENU_OPTIONS {
MENU_SEND_SMS,
MENU_COPY_SMS,
MENU_ADD_SMS,
MENU_POST_FACEBOOK,
MENU_TWEET
}
和I具有接受INT
menu.add (int, int, int, String);
所以當我提供「MENU_OPTIONS.MENU_SEND_SMS」上面的方法,它是這樣的方法報告錯誤
menu.add(0, MENU_SEND_SMS, 0,); // error: The method add(int, int, int, CharSequence) in the type Menu is not applicable for the arguments (int, FavoriteSMSFragment.MENU_OPTIONS, int, String)
所以如果我想使用一組固定的常量,應該如何定義ENUM?
+1 for ordinal ) – A4L 2013-04-20 15:39:07