I am trying to add a menu in my application. It works if it extends AppCompatActivity
, but not if it extends Activity
. Is the menu not available in Activity
? People say Activity
is basic where AppCompatActivity
is something developed later. Is there any good reason I should use Activity
instead of AppCompatActivity
? AppCompatActivity
is the default but in my learning it was recommended to choose Activity
, but I encountered the problem in creating the menu (action bar). Please help!
AppCompatActivity is a class from v7 Appcompat library. This is a compatibility library that back ports some features of recent versions of Android to older devices.
It enables the use of the ActionBar and Material Design specific implementations like the Toolbar for older devices using versions of Android as old as Android 2.1 (API level 7). So if your app's minSdkVersion is a version that does not support the new features in newer APIs you can use the support library to enable those features. If you use support library ,you have to have all your activities extend AppCompatActivity instead of the Activity base class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With