0

Guys I am working on a android project in which lots of enum is getting used. now I am writing the whole project from scratch and I want to avoid enums.

I understand that enum provides better code readability and maintainability and type safety. but as per the android documentation I should be avoid using enums.

I have read lots of article related to this and almost every one says that you should avoid using enums in android until unless you are not utilising the power of enum like overriding methods

I am confused now , so the question is should I use enum or not , I was thinking to replace all the enum with class and public static final , what do you guys suggest.

Tim
  • 41,901
  • 18
  • 127
  • 145
Naga
  • 1,931
  • 4
  • 25
  • 42
  • I have read that but it does not answer my question – Naga Oct 15 '15 at 10:44
  • I am confused , I have all these links on Stackoverflow – Naga Oct 15 '15 at 10:45
  • I disagree, it is a perfect answer to your question. It explains when you should and should not use. It's not black and white. you don't either use enums everywhere, or not use them *at all*. You use them when they suit the situation best. – Tim Oct 15 '15 at 10:46
  • Sorry for misunderstanding , So I will be avoid using enums until unless it is not necessary, will it be fine for me ? – Naga Oct 15 '15 at 10:51
  • 1
    Rule of thumb: use static constants, unless you need some functionality that an enum offers that a static constant does not, in that case use an enum – Tim Oct 15 '15 at 10:52
  • Great , thats what one line answer I wanted ,awesome – Naga Oct 15 '15 at 11:14

0 Answers0