{"id":4058,"date":"2013-06-02T18:46:23","date_gmt":"2013-06-02T15:46:23","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=4058"},"modified":"2013-06-25T22:52:07","modified_gmt":"2013-06-25T19:52:07","slug":"android-actionbar-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/","title":{"rendered":"Android ActionBar Example"},"content":{"rendered":"<p>In this tutorial we are going to see how to \u00a0create a simple Android Menu using <a href=\"http:\/\/developer.android.com\/guide\/topics\/ui\/actionbar.html\"><code>ActionBar<\/code><\/a>. It is a very handy kit when you want to create simple Menus for your application. In this tutorial we are going to see how to create a simple menu with 3 options and with Icons.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\nFor this tutorial, we will use the following tools in a Windows 64-bit platform:<\/p>\n<ol>\n<li>JDK 1.7<\/li>\n<li>Eclipse 4.2 Juno<\/li>\n<li>Android SKD 4.2<\/li>\n<\/ol>\n<h3>1. Create a new Android Project<\/h3>\n<p>Open Eclipse IDE and go to File -&gt; New -&gt; Project -&gt; Android -&gt; Android Application Project.<\/p>\n<p>You have to specify the Application Name, the Project Name and the Package name in the appropriate text fields and then click Next.<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/create-new-project.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-4060\" alt=\"create-new-project\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/create-new-project.jpg\" width=\"520\" height=\"436\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/create-new-project.jpg 520w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/create-new-project-300x251.jpg 300w\" sizes=\"(max-width: 520px) 100vw, 520px\" \/><\/a><\/p>\n<p>In the next window make sure the \u201cCreate activity\u201d option is selected in order to create a new activity for your project, and click Next. This is optional as you can create a new activity after creating the project, but you can do it all in one step.<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/check-create-new-activity.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-4059\" alt=\"check-create-new-activity\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/check-create-new-activity.jpg\" width=\"518\" height=\"482\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/check-create-new-activity.jpg 518w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/check-create-new-activity-300x279.jpg 300w\" sizes=\"(max-width: 518px) 100vw, 518px\" \/><\/a><\/p>\n<p>Select \u201cBlankActivity\u201d and click Next.<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"http:\/\/cdn.javacodegeeks.com\/wp-content\/uploads\/2013\/05\/create-blanc-activity.jpg\" \/><\/p>\n<p>You will be asked to specify some information about the new activity. \u00a0In the Layout Name text field you have to specify the name of the file that will contain the layout description of your app. In our case the file\u00a0<code>res\/layout\/main.xml<\/code>\u00a0will be created. Then, click Finish.<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"http:\/\/cdn.javacodegeeks.com\/wp-content\/uploads\/2013\/05\/new-activity-attr.jpg\" \/><\/p>\n<h3>2. Add Drawable resources<\/h3>\n<p>In order to display Icons instead of text in the ActionBar, we need to add the images we want in the drawable resources. Go to package Explorer. You can drag and drop the images from your local files to the project files. As you can see I&#8217;ve copied 3 images.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/drawables.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-4061\" alt=\"drawables\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/drawables.jpg\" width=\"435\" height=\"372\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/drawables.jpg 435w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/drawables-300x256.jpg 300w\" sizes=\"(max-width: 435px) 100vw, 435px\" \/><\/a><\/p>\n<h3>3. Creating the menu items<\/h3>\n<p>Open\u00a0<code>res\/menu\/main.xml<\/code>\u00a0file :<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/menu-main-xml.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-4066\" alt=\"menu-main-xml\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/menu-main-xml.jpg\" width=\"309\" height=\"475\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/menu-main-xml.jpg 309w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/menu-main-xml-195x300.jpg 195w\" sizes=\"(max-width: 309px) 100vw, 309px\" \/><\/a><\/p>\n<p>And paste the following code :<\/p>\n<p><span style=\"text-decoration: underline;\"><em>main.xml:<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;menu xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\" &gt;\r\n\r\n    &lt;item\r\n        android:id=\"@+id\/action_settings\"\r\n        android:orderInCategory=\"100\"\r\n        android:showAsAction=\"never\"\r\n        android:title=\"@string\/action_settings\"\/&gt;\r\n    &lt;item\r\n        android:id=\"@+id\/home\"\r\n        android:icon=\"@drawable\/home\"\r\n        android:orderInCategory=\"1\"\r\n        android:showAsAction=\"always\"\r\n        android:title=\"Home\"\/&gt;\r\n\r\n    &lt;item\r\n        android:id=\"@+id\/java\"\r\n        android:icon=\"@drawable\/java\"\r\n        android:orderInCategory=\"2\"\r\n        android:showAsAction=\"always\"\r\n        android:title=\"Java\"\/&gt;\r\n\r\n    &lt;item\r\n        android:id=\"@+id\/android\"\r\n        android:icon=\"@drawable\/android\"\r\n        android:orderInCategory=\"3\"\r\n        android:showAsAction=\"always\"\r\n        android:title=\"Android\"\/&gt;\r\n\r\n&lt;\/menu&gt;<\/pre>\n<p>Now let&#8217;s see what all these attributes do:<\/p>\n<ul>\n<li>First of all, <code>android:orderInCategory<\/code> dictates the position of the Item in the <code>ActionBar<\/code>.<\/li>\n<li><code>android:showAsAction<\/code> defines the way we want the Item to be displayed. For example, in our case we want the items to be always visible. We can change that to <code>ifRoom<\/code>. Now, Android will see if there is sufficient room in the screen, and if there is the option will be displayed. Else it will be places to the Overflow option. Additionally you can choose <code>never<\/code> as value. In this case the option will be hidden.<\/li>\n<li><code>android:icon<\/code> will define the icon of the option, which as you can see, will be a drawable resource.<\/li>\n<\/ul>\n<h3>4. Code the Main Activity<\/h3>\n<p>Use the Package Explorer to navigate to the Java file of the Activity you\u2019ve created:<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/main-src-file.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-4369\" alt=\"main-src-file\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/main-src-file.jpg\" width=\"485\" height=\"316\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/main-src-file.jpg 485w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/main-src-file-300x195.jpg 300w\" sizes=\"(max-width: 485px) 100vw, 485px\" \/><\/a><\/p>\n<p><span style=\"text-decoration: underline;\"><em>MainActivity.java:<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.android.androidactionbarexample;\r\n\r\nimport android.annotation.SuppressLint;\r\nimport android.app.ActionBar;\r\nimport android.app.Activity;\r\nimport android.content.Intent;\r\nimport android.os.Bundle;\r\nimport android.view.Menu;\r\nimport android.view.MenuItem;\r\nimport android.webkit.WebView;\r\nimport android.widget.Toast;\r\n\r\npublic class MainActivity extends Activity {\r\n\r\n\t@Override\r\n\tprotected void onCreate(Bundle savedInstanceState) {\r\n\t\tsuper.onCreate(savedInstanceState);\r\n\t\tsetContentView(R.layout.main);\r\n\t}\r\n\r\n\t@SuppressLint(\"NewApi\")\r\n\t@Override\r\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\r\n\r\n\t\tgetMenuInflater().inflate(R.menu.main, menu);\r\n\t\treturn true;\r\n\t}\r\n\r\n\t@Override\r\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\r\n\r\n\t\tswitch (item.getItemId()) {\r\n\r\n\t\tcase R.id.home:\r\n\t\t\thomeActivity();\r\n\t\t\treturn true;\r\n\r\n\t\tcase R.id.java:\r\n\t\t\tjavaActivity();\r\n\t\t\treturn true;\r\n\r\n\t\tcase R.id.android:\r\n\t\t\tandroidActivity();\r\n\t\t\treturn true;\r\n\r\n\t\tdefault:\r\n\t\t\treturn super.onOptionsItemSelected(item);\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tpublic void homeActivity() {\r\n\t\tToast.makeText(this, \"Home Option Selexted\", Toast.LENGTH_SHORT).show();\r\n\t}\r\n\r\n\tpublic void javaActivity() {\r\n\t\tToast.makeText(this, \"Java Option Selexted\", Toast.LENGTH_SHORT).show();\r\n\t}\r\n\r\n\tpublic void androidActivity() {\r\n\t\tToast.makeText(this, \"Android Option Selexted\", Toast.LENGTH_SHORT).show();\r\n\t}\r\n\r\n}<\/pre>\n<h3>5. Run the application<\/h3>\n<p>This is the main screen of our Application:<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/main-screen.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-4064\" alt=\"main-screen\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/main-screen.jpg\" width=\"496\" height=\"838\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/main-screen.jpg 496w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/main-screen-177x300.jpg 177w\" sizes=\"(max-width: 496px) 100vw, 496px\" \/><\/a><\/p>\n<p>Now, when you press the on one of the options :<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/java-option.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-4062\" alt=\"java-option\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/java-option.jpg\" width=\"496\" height=\"838\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/java-option.jpg 496w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/java-option-177x300.jpg 177w\" sizes=\"(max-width: 496px) 100vw, 496px\" \/><\/a><\/p>\n<p>Of course you can customize the Actions as much as you want&#8230;<\/p>\n<h3>Download Eclipse Project<\/h3>\n<p>This was an Android Action Bar and Menus Example. Download the Eclipse Project of this tutorial:\u00a0<a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/06\/AndroidActionBarExample.zip\">AndroidActionBarExample.zip<\/a><a href=\"http:\/\/jcg-examples.javacodegeeks.netdna-cdn.com\/wp-content\/uploads\/2013\/05\/AndroidIntentExample.zip\"><br \/>\n<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial we are going to see how to \u00a0create a simple Android Menu using ActionBar. It is a very handy kit when you want to create simple Menus for your application. In this tutorial we are going to see how to create a simple menu with 3 options and with Icons. &nbsp; &nbsp; &hellip;<\/p>\n","protected":false},"author":4,"featured_media":1202,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[454,453,452],"tags":[],"class_list":["post-4058","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-actionbar","category-app","category-menu"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Android ActionBar Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In this tutorial we are going to see how to \u00a0create a simple Android Menu using ActionBar. It is a very handy kit when you want to create simple Menus for\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android ActionBar Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In this tutorial we are going to see how to \u00a0create a simple Android Menu using ActionBar. It is a very handy kit when you want to create simple Menus for\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2013-06-02T15:46:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-06-25T19:52:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Nikos Maravitsas\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nikos Maravitsas\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/\"},\"author\":{\"name\":\"Nikos Maravitsas\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/686a494fbb577a8d1231862b139cda6b\"},\"headline\":\"Android ActionBar Example\",\"datePublished\":\"2013-06-02T15:46:23+00:00\",\"dateModified\":\"2013-06-25T19:52:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/\"},\"wordCount\":481,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"articleSection\":[\"ActionBar\",\"app\",\"Menu\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/\",\"name\":\"Android ActionBar Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"datePublished\":\"2013-06-02T15:46:23+00:00\",\"dateModified\":\"2013-06-25T19:52:07+00:00\",\"description\":\"In this tutorial we are going to see how to \u00a0create a simple Android Menu using ActionBar. It is a very handy kit when you want to create simple Menus for\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"core\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"app\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/app\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"ActionBar\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/app\/actionbar\/\"},{\"@type\":\"ListItem\",\"position\":6,\"name\":\"Android ActionBar Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/686a494fbb577a8d1231862b139cda6b\",\"name\":\"Nikos Maravitsas\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/10\/Nikos-Maravitsas-80x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/10\/Nikos-Maravitsas-80x96.jpg\",\"caption\":\"Nikos Maravitsas\"},\"description\":\"Nikos has graduated from the Department of Informatics and Telecommunications of The National and Kapodistrian University of Athens. During his studies he discovered his interests about software development and he has successfully completed numerous assignments in a variety of fields. Currently, his main interests are system\u2019s security, parallel systems, artificial intelligence, operating systems, system programming, telecommunications, web applications, human \u2013 machine interaction and mobile development.\",\"sameAs\":[\"http:\/\/www.javacodegeeks.com\/\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/nikos-maravitsas\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android ActionBar Example - Java Code Geeks","description":"In this tutorial we are going to see how to \u00a0create a simple Android Menu using ActionBar. It is a very handy kit when you want to create simple Menus for","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:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/","og_locale":"en_US","og_type":"article","og_title":"Android ActionBar Example - Java Code Geeks","og_description":"In this tutorial we are going to see how to \u00a0create a simple Android Menu using ActionBar. It is a very handy kit when you want to create simple Menus for","og_url":"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2013-06-02T15:46:23+00:00","article_modified_time":"2013-06-25T19:52:07+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","type":"image\/jpeg"}],"author":"Nikos Maravitsas","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Nikos Maravitsas","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/"},"author":{"name":"Nikos Maravitsas","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/686a494fbb577a8d1231862b139cda6b"},"headline":"Android ActionBar Example","datePublished":"2013-06-02T15:46:23+00:00","dateModified":"2013-06-25T19:52:07+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/"},"wordCount":481,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","articleSection":["ActionBar","app","Menu"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/","url":"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/","name":"Android ActionBar Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","datePublished":"2013-06-02T15:46:23+00:00","dateModified":"2013-06-25T19:52:07+00:00","description":"In this tutorial we are going to see how to \u00a0create a simple Android Menu using ActionBar. It is a very handy kit when you want to create simple Menus for","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/view\/menu\/android-actionbar-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Android","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/"},{"@type":"ListItem","position":3,"name":"core","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/"},{"@type":"ListItem","position":4,"name":"app","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/app\/"},{"@type":"ListItem","position":5,"name":"ActionBar","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/app\/actionbar\/"},{"@type":"ListItem","position":6,"name":"Android ActionBar Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/686a494fbb577a8d1231862b139cda6b","name":"Nikos Maravitsas","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/10\/Nikos-Maravitsas-80x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/10\/Nikos-Maravitsas-80x96.jpg","caption":"Nikos Maravitsas"},"description":"Nikos has graduated from the Department of Informatics and Telecommunications of The National and Kapodistrian University of Athens. During his studies he discovered his interests about software development and he has successfully completed numerous assignments in a variety of fields. Currently, his main interests are system\u2019s security, parallel systems, artificial intelligence, operating systems, system programming, telecommunications, web applications, human \u2013 machine interaction and mobile development.","sameAs":["http:\/\/www.javacodegeeks.com\/"],"url":"https:\/\/examples.javacodegeeks.com\/author\/nikos-maravitsas\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/4058","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=4058"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/4058\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1202"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=4058"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=4058"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=4058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}