

{"id":77501,"date":"2020-05-01T15:51:32","date_gmt":"2020-05-01T10:21:32","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=77501"},"modified":"2021-02-25T16:06:18","modified_gmt":"2021-02-25T10:36:18","slug":"android-menu","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/android-menu\/","title":{"rendered":"Android Menu &#8211; Steps to implement Menu in Android"},"content":{"rendered":"<p>Welcome back to<strong> DataFlair Android Tutorial Series.\u00a0<\/strong>Today in this article, we are going to learn and implement <strong>Android Menu<\/strong>. A Menu is a crucial part of the User Interface that handles frequent functionalities of the application. The menu helps us provide a user-friendly interface that handles a lot of actions.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/android-menu.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77720\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/android-menu.jpg\" alt=\"android menu\" width=\"802\" height=\"420\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/android-menu.jpg 802w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/android-menu-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/android-menu-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/android-menu-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/android-menu-520x272.jpg 520w\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" \/><\/a><\/p>\n<p>Before proceeding ahead, learn top <a href=\"https:\/\/data-flair.training\/blogs\/android-ui-controls\/\">UI Controls<\/a> for your application.<\/p>\n<h2>Types of Android Menu<\/h2>\n<p>Let us see the various types of menu in Android:<\/p>\n<h3>1. Android Options Menu<\/h3>\n<p>The Options Menu is a collection of options for an activity. It has a set of items that are useful to perform actions. It helps us to combine multiple actions together.<\/p>\n<p>Following is an example of Options Menu:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/options-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77766\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/options-1.png\" alt=\"Options Menu in Android\" width=\"250\" height=\"444\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/options-1.png 250w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/options-1-84x150.png 84w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/options-1-169x300.png 169w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3>2. PopUp Menu<\/h3>\n<p>Pop-Up menu is a menu that displays a list of items in a popup window. A pop-up menu appears below the view by default, in case there is no space, it appears above it.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/pop-up-screen.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77714\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/pop-up-screen.jpg\" alt=\"Android Pop Up menu\" width=\"223\" height=\"326\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/pop-up-screen.jpg 223w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/pop-up-screen-103x150.jpg 103w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/pop-up-screen-205x300.jpg 205w\" sizes=\"auto, (max-width: 223px) 100vw, 223px\" \/><\/a><\/p>\n<h3>3. Contextual Menu<\/h3>\n<p>A contextual menu is a floating menu. It appears only when the users long-press an element or right clicks on that. It generally affects the selected element.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/Contextual-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77767\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/Contextual-1.png\" alt=\"Contextual menu\" width=\"250\" height=\"444\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/Contextual-1.png 250w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/Contextual-1-84x150.png 84w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/Contextual-1-169x300.png 169w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<h2>How to Define Android Menu<\/h2>\n<p>To define it, we need to write its code in a layout file. And that file is created in the resource folder as, res\/menu\/file.xml. Here, file can be any name that you provide. Following are important elements of a menu:<\/p>\n<table class=\"df-table-center\">\n<tbody>\n<tr>\n<td><b>&lt;element&gt;<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&lt;menu&gt;<\/span><\/td>\n<td>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">It defines a Menu, that contains the options<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Holds one or more elements<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">It must be the root of a file.<\/span><\/li>\n<\/ol>\n<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&lt;items&gt;<\/span><\/td>\n<td>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Items are the options that are present in the Menu<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">It must be in the menu element<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">It can contain a nested &lt;menu&gt; element to create a submenu.<\/span><\/li>\n<\/ol>\n<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&lt;group&gt;<\/span><\/td>\n<td>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Categorizes the menu items and contains those with common properties.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">It is optional and invisible container for elements.<\/span><\/li>\n<\/ol>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>You can define it as:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;menu xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"&gt;\r\n   &lt;item\r\n       android:id=\"@+id\/search\"\r\n       android:title=\"Search Here\" \/&gt;\r\n   &lt;item\r\n       android:id=\"@+id\/filter\"\r\n       android:title=\"Apply Filter\" \/&gt;\r\n   &lt;item\r\n       android:id=\"@+id\/My_account\"\r\n       android:title=\"My Account\" \/&gt;\r\n&lt;\/menu&gt;<\/pre>\n<p>Like any other UI component, even Android menus can be customized with the help of <a href=\"https:\/\/developer.android.com\/reference\/org\/xml\/sax\/Attributes\">attributes<\/a> like-<\/p>\n<p><strong>1. android: id<\/strong><\/p>\n<p>It uniquely identifies the item of the menu.<\/p>\n<p><strong>2. android: icon<\/strong><\/p>\n<p>It sets an icon to represent the item.<\/p>\n<p><strong>3. android: title<\/strong><\/p>\n<p>It sets the title of the item.<\/p>\n<p><strong>4. android:showAsAction<\/strong><\/p>\n<p>It specifies when and how this item should appear as an action item in the app bar.<\/p>\n<h2>Implementation of Android Menu<\/h2>\n<p>Let us now see how easy it is to implement Menu in Android. Below are the steps to implement Android Menu:<\/p>\n<p>1. First, create a new project and name it.<\/p>\n<p>2. Now, create a new <strong>xml<\/strong> file with the name it main_menu.xml, and write the following code:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;menu xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"&gt;\r\n   &lt;item\r\n       android:id=\"@+id\/search\"\r\n       android:title=\"Search Here\" \/&gt;\r\n   &lt;item\r\n       android:id=\"@+id\/filter\"\r\n       android:title=\"Apply Filter\" \/&gt;\r\n   &lt;item\r\n       android:id=\"@+id\/wishlist\"\r\n       android:title=\"My Wishlist\" \/&gt;\r\n   &lt;item\r\n       android:id=\"@+id\/MyCart\"\r\n       android:title=\"My Cart\" \/&gt;\r\n   &lt;item\r\n       android:id=\"@+id\/My_account\"\r\n       android:title=\"My Account\" \/&gt;\r\n&lt;\/menu&gt;\r\n<\/pre>\n<p>3. After that write the following code in the MainActivity.java file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.DataFlair.mymenu;\r\n\r\nimport android.os.Bundle;\r\nimport android.view.Menu;\r\nimport android.view.MenuItem;\r\nimport android.widget.Toast;\r\n\r\nimport androidx.appcompat.app.AppCompatActivity;\r\n\r\n\r\npublic class MainActivity extends AppCompatActivity {\r\n   @Override\r\n   protected void onCreate(Bundle savedInstanceState) {\r\n       super.onCreate(savedInstanceState);\r\n       setContentView(R.layout.activity_main);\r\n   }\r\n\/\/ Overriding onCreateoptionMenu() to make Option menu   \r\n@Override\r\n   public boolean onCreateOptionsMenu(Menu menu) {\r\n   \/\/Inflating menu by overriding inflate() method of MenuInflater class.\r\n   \/\/Inflating here means parsing layout XML to views.\r\n       getMenuInflater().inflate(R.menu.main_menu, menu);\r\n       return true;\r\n   }\r\n\/\/Overriding onOptionsItemSelected to perform event on menu items\r\n   @Override\r\n   public boolean onOptionsItemSelected(MenuItem menuItem) {\r\n       Toast.makeText(this, \"You chose : \" + menuItem.getTitle(), Toast.LENGTH_SHORT).show();\r\n       switch (menuItem.getItemId()) {\r\n           case R.id.search:\r\n               \/\/Your code here\r\n               return true;\r\n           case R.id.filter:\r\n               \/\/Your code here\r\n               return true;\r\n           case R.id.wishlist:\r\n               \/\/Your code here\r\n               return true;\r\n           case R.id.MyCart:\r\n               \/\/Your code here\r\n               return true;\r\n           case R.id.My_account:\r\n               \/\/Your code here\r\n               return true;\r\n           default:\r\n               return super.onOptionsItemSelected(menuItem);\r\n       }\r\n   }\r\n}\r\n<\/pre>\n<p>4. This is the color code of the app, write this in the colors.xml file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;resources&gt;\r\n   &lt;color name=\"colorPrimary\"&gt;#00796B&lt;\/color&gt;\r\n   &lt;color name=\"colorPrimaryDark\"&gt;#03574D&lt;\/color&gt;\r\n   &lt;color name=\"colorAccent\"&gt;#C2185B&lt;\/color&gt;\r\n&lt;\/resources&gt;\r\n<\/pre>\n<p>5. After that, the following would be the output:<br \/>\nBelow is the app:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/Screenshot1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77716\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/Screenshot1.png\" alt=\"Android Menu\" width=\"300\" height=\"533\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/Screenshot1.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/Screenshot1-84x150.png 84w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/Screenshot1-169x300.png 169w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>This is the Menu:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/Screenshot2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77717\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/Screenshot2.png\" alt=\"Android menu Bar\" width=\"300\" height=\"533\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/Screenshot2.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/Screenshot2-84x150.png 84w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/Screenshot2-169x300.png 169w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>This is the toast generated that tells the chosen option:<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/Screenshot3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-77718 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/Screenshot3.png\" alt=\"Menu in Android\" width=\"300\" height=\"533\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/Screenshot3.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/Screenshot3-84x150.png 84w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/04\/Screenshot3-169x300.png 169w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h2>Summary<\/h2>\n<p>In this Android tutorial, we have read about Android Menu. We have discussed types of menu in Android and how we can define them. We also saw its implementation in our application and now it is your turn to implement it and learn. Thank You!<\/p>\n<p><strong>I hope you liked this article. Do refer to our sidebar for <a href=\"https:\/\/data-flair.training\/blogs\/category\/android\/\">more Android articles<\/a>.<\/strong><span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:1145,&quot;href&quot;:&quot;https:\\\/\\\/developer.android.com\\\/reference\\\/org\\\/xml\\\/sax\\\/Attributes&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20250902145547\\\/https:\\\/\\\/developer.android.com\\\/reference\\\/org\\\/xml\\\/sax\\\/Attributes&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-09 01:55:36&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2025-12-12 04:05:39&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2025-12-15 07:12:59&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2025-12-18 17:41:11&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2025-12-22 06:57:59&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2025-12-25 20:27:45&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2025-12-29 09:57:39&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-01-01 18:38:22&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-01-04 19:46:00&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-01-09 10:02:50&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-01-12 17:43:05&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-01-16 07:18:57&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-01-19 09:53:49&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-01-22 10:56:27&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-01-26 02:47:13&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-01-29 04:48:11&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-02-01 21:34:58&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-02-05 02:23:42&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-02-08 05:38:52&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-02-11 11:09:06&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-02-14 15:19:24&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-02-18 17:04:05&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-02-23 05:10:31&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-02-26 17:17:04&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-03-02 07:56:20&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-03-06 11:19:08&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-03-09 14:21:41&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-03-13 11:28:45&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-03-16 16:15:01&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-03-19 17:26:37&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-03-23 06:14:01&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-03-26 10:55:57&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-03-29 19:30:05&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-04-02 04:35:00&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-04-05 08:08:51&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-04-09 12:13:21&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-04-13 07:26:38&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-04-17 00:04:41&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-04-20 11:07:06&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-04-24 14:54:43&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-04-28 08:30:57&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-05-02 16:13:08&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-05-06 23:08:33&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-05-11 03:53:44&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-05-14 09:58:30&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-05-17 11:19:46&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-05-21 05:52:06&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-05-25 08:09:06&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-05-28 12:38:51&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-06-01 14:06:20&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-06-05 08:45:38&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-06-08 14:35:18&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-06-14 09:45:21&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-06-17 13:19:19&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-06-21 04:20:39&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-06-24 07:44:21&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-06-28 09:49:06&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-07-01 11:32:13&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-07-05 00:52:46&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-07-08 07:52:32&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-07-12 00:48:04&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-07-15 12:23:15&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-07-19 04:31:01&quot;,&quot;http_code&quot;:503}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-07-19 04:31:01&quot;,&quot;http_code&quot;:503},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Welcome back to DataFlair Android Tutorial Series.\u00a0Today in this article, we are going to learn and implement Android Menu. A Menu is a crucial part of the User Interface that handles frequent functionalities of&#46;&#46;&#46;<\/p>\n","protected":false},"author":7,"featured_media":77720,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18722],"tags":[22171,22231,22233,22170,22172,22232,22173],"class_list":["post-77501","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","tag-android-menu","tag-android-menu-types","tag-contextual-menu","tag-menu-android","tag-menu-in-android","tag-options-menu","tag-types-of-menu-in-android"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Android Menu - Steps to implement Menu in Android - DataFlair<\/title>\n<meta name=\"description\" content=\"Implement Android Menu in your application - Provide functionality to your application and make it user friendly. Also, Learn its types and implementation.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/android-menu\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android Menu - Steps to implement Menu in Android - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Implement Android Menu in your application - Provide functionality to your application and make it user friendly. Also, Learn its types and implementation.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/android-menu\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-05-01T10:21:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-02-25T10:36:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/android-menu.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android Menu - Steps to implement Menu in Android - DataFlair","description":"Implement Android Menu in your application - Provide functionality to your application and make it user friendly. Also, Learn its types and implementation.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/android-menu\/","og_locale":"en_US","og_type":"article","og_title":"Android Menu - Steps to implement Menu in Android - DataFlair","og_description":"Implement Android Menu in your application - Provide functionality to your application and make it user friendly. Also, Learn its types and implementation.","og_url":"https:\/\/data-flair.training\/blogs\/android-menu\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2020-05-01T10:21:32+00:00","article_modified_time":"2021-02-25T10:36:18+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/android-menu.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/android-menu\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/android-menu\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd"},"headline":"Android Menu &#8211; Steps to implement Menu in Android","datePublished":"2020-05-01T10:21:32+00:00","dateModified":"2021-02-25T10:36:18+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/android-menu\/"},"wordCount":556,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/android-menu\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/android-menu.jpg","keywords":["Android Menu","android menu types","contextual menu","menu android","Menu in Android","options menu","types of menu in android"],"articleSection":["Android Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/android-menu\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/android-menu\/","url":"https:\/\/data-flair.training\/blogs\/android-menu\/","name":"Android Menu - Steps to implement Menu in Android - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/android-menu\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/android-menu\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/android-menu.jpg","datePublished":"2020-05-01T10:21:32+00:00","dateModified":"2021-02-25T10:36:18+00:00","description":"Implement Android Menu in your application - Provide functionality to your application and make it user friendly. Also, Learn its types and implementation.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/android-menu\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/android-menu\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/android-menu\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/android-menu.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/05\/android-menu.jpg","width":802,"height":420,"caption":"android menu"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/android-menu\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Android Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/android\/"},{"@type":"ListItem","position":3,"name":"Android Menu &#8211; Steps to implement Menu in Android"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team specializes in creating clear, actionable content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Backed by industry expertise, we make learning easy and career-oriented for beginners and pros alike.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam3\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/77501","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=77501"}],"version-history":[{"count":14,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/77501\/revisions"}],"predecessor-version":[{"id":77768,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/77501\/revisions\/77768"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/77720"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=77501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=77501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=77501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}