Just wondering. In any code snippet I saw (also ADT-generated code) the ActionBar
is qualified as final. In my app I do not use the final
qualifier for the ActionBar
and everything's fine. Any information/links on that topic?
Asked
Active
Viewed 43 times
1

Droidman
- 11,485
- 17
- 93
- 141
-
Can you give an example code snippet you're referring to? A code snippet from the official docs would be best. – Will Eddins Aug 08 '13 at 16:08
-
well the best example is creating an Activity with ActionBar using the Eclipse ADT plugin. It always defines the ActionBar as final and I'm just curious why. I guess some sites where I saw the same could not be called a reliable source – Droidman Aug 08 '13 at 16:13
-
Making a variable as `final` turns it in a constant. That means you can't set a new value to your `ActionBar` type variable. – yugidroid Aug 08 '13 at 16:17
-
@yugidroid you don't say, mate?^^ I know what final means, just curious why it's used pretty often when handling with an ActionBar – Droidman Aug 08 '13 at 16:20
-
@Maver1ck The reason I asked for code is because you usually don't "create the action bar", you extend an activity that uses an `ActionBar`, such as `ActionBarActivity`. `final` in this case is just making your activity non-extendable, then the question is just similar to this: http://stackoverflow.com/questions/5181578/use-of-final-class-in-java – Will Eddins Aug 08 '13 at 16:35