To answer your first question, depending on how you created your project in the first place, it was probably enabled for you automatically. There are lots of other things in the support library besides ActionBar, so even if your minSdkVersion=11, it's probably still a good idea to use it.
To answer your second question, yes, it's normal that both methods work. Framework methods are not disabled or removed when you enable the support library. They will still work as long as they are supported by the Android OS you're eventually running on. For example, if your minSdkVersion was 10 instead of 11 and you tried to run the app on a device running Gingerbread, it would crash on the getActionBar()
call.
In your case, you should use the framework method (getActionBar()
). The documentation for ActionBar says:
This class is included in the support library for compatibility with API level 7 and higher. If you're developing your app for API level 11 and higher only, you should instead use the framework
ActionBar
class.
The best way to know whether you need to use the support library for a given method or class is to refer to the documentation for that class and pay attention to the "Added in API Level ?" notation. Here is the documentation non-support-library version of ActionBar
, where you can see that some methods were added after API 11. If you need any of those methods, you should use the support library.
Also, as I said before, there other things besides ActionBar
to consider in your app. GridLayout is an example. It was added in API 14, but it also exists in the support library for backwards compatibility. If you want to use GridLayout
, you should use the support library version of it.