{"id":1310,"date":"2012-12-17T17:06:09","date_gmt":"2012-12-17T15:06:09","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=1310"},"modified":"2013-01-30T19:32:01","modified_gmt":"2013-01-30T17:32:01","slug":"android-checkbox-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/","title":{"rendered":"Android Checkbox Example"},"content":{"rendered":"<p>One of the\u00a0easiest and most common\u00a0ways to accept user input in an Android Application is the Checkbox component. In this tutorial we are going to see how to set up and display a checkbox list with some options for the user. Furthermore, we are going to use a button that when it&#8217;s pressed, a message will be displayed reflecting the status of the checkboxes and that is checked or unchecked.<\/p>\n<p>For 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.\u00a0You 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\/2012\/12\/create-new-project2.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1311\" title=\"create-new-project\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/create-new-project2.jpg\" alt=\"\" width=\"621\" height=\"451\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/create-new-project2.jpg 621w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/create-new-project2-300x217.jpg 300w\" sizes=\"(max-width: 621px) 100vw, 621px\" \/><\/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\/2012\/12\/check-create-new-activity.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1312\" title=\"check-create-new-activity\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/check-create-new-activity.jpg\" alt=\"\" width=\"621\" height=\"466\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/check-create-new-activity.jpg 621w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/check-create-new-activity-300x225.jpg 300w\" sizes=\"(max-width: 621px) 100vw, 621px\" \/><\/a><\/p>\n<p>Select \u201cBlankActivity\u201d and click Next.<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/create-blanc-activity.jpg\"><img decoding=\"async\" title=\"create-blanc-activity\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/create-blanc-activity.jpg\" alt=\"\" width=\"535\" height=\"485\" \/><\/a><\/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\/<span style=\"text-decoration: underline;\">main<\/span>.xml<\/code>\u00a0will be created.Then, click Finish.<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/create-new-activity-attributes3.jpg\"><img decoding=\"async\" title=\"create-new-activity-attributes\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/create-new-activity-attributes3.jpg\" alt=\"\" width=\"625\" height=\"452\" \/><\/a><\/p>\n<h3>2. Adding resources<\/h3>\n<p>Use the Package Explorer in Eclipse to navigate to\u00a0<code>res\/values\/strings.xml<\/code><\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/package-explorer-strings2.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1313\" title=\"package-explorer-strings\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/package-explorer-strings2.jpg\" alt=\"\" width=\"379\" height=\"493\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/package-explorer-strings2.jpg 379w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/package-explorer-strings2-230x300.jpg 230w\" sizes=\"(max-width: 379px) 100vw, 379px\" \/><\/a><div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>When you open the<code> strings.xml<\/code> file, Eclipse will display the graphical Resources View editor :<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/resources-view.jpg\"><img decoding=\"async\" title=\"resources-view\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/resources-view.jpg\" alt=\"\" width=\"531\" height=\"419\" \/><\/a><\/p>\n<p>That\u2019s a nice and easy tool you can use to add several resources to your application\u00a0like strings, integers, color values etc. But we are going to use the traditional way and that is editing the\u00a0<code>strings.xml\u00a0<\/code>file by hand. In the bottom of the screen, press the\u00a0<code>string.xml\u00a0<\/code>tab and paste the following code :<\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;resources&gt;\r\n    &lt;string name=\"app_name\"&gt;CheckboxExample&lt;\/string&gt;\r\n    &lt;string name=\"linux_box\"&gt;Linux&lt;\/string&gt;\r\n    &lt;string name=\"macos_box\"&gt;Mac OS&lt;\/string&gt;\r\n    &lt;string name=\"windows_box\"&gt;Windows&lt;\/string&gt;\r\n    &lt;string name=\"display_label\"&gt;Display&lt;\/string&gt;\r\n    &lt;string name=\"menu_settings\"&gt;Settings&lt;\/string&gt;\r\n\r\n&lt;\/resources&gt;<\/pre>\n<p>So we\u2019ve just created some string resources that we can use in many ways and in many places in our app.<\/p>\n<h3>3. Creating a Ceckbox list<\/h3>\n<p>Open\u00a0<code>res\/layout\/main.xml<\/code>\u00a0file :<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/package-explorer-layout3.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1315\" title=\"package-explorer-layout\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/package-explorer-layout3.jpg\" alt=\"\" width=\"365\" height=\"455\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/package-explorer-layout3.jpg 365w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/package-explorer-layout3-240x300.jpg 240w\" sizes=\"(max-width: 365px) 100vw, 365px\" \/><\/a><\/p>\n<p>And paste the following code :<\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;LinearLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n    android:layout_width=\"fill_parent\"\r\n    android:layout_height=\"fill_parent\"\r\n    android:orientation=\"vertical\" &gt;\r\n\r\n    &lt;CheckBox\r\n        android:id=\"@+id\/linux_option\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:text=\"@string\/linux_box\" \/&gt;\r\n\r\n    &lt;CheckBox\r\n        android:id=\"@+id\/macos_option\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:text=\"@string\/macos_box\"\r\n        android:checked=\"true\" \/&gt;\r\n\r\n    &lt;CheckBox\r\n        android:id=\"@+id\/windows_option\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:text=\"@string\/windows_box\" \/&gt;\r\n\r\n    &lt;Button\r\n        android:id=\"@+id\/button\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:text=\"@string\/display_label\" \/&gt;\r\n\r\n&lt;\/LinearLayout&gt;<\/pre>\n<p>In the code of the second checkbox (the &#8220;Mac OS&#8221; option), notice the <code>android:checked=\"true\"\u00a0<\/code>attribute. You may use this when you want an option to be checked by default. Now you may open the Graphical layout editor to preview the User Interface you created:<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/graphical-layout-editor3.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1327\" title=\"graphical-layout-editor\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/graphical-layout-editor3.jpg\" alt=\"\" width=\"672\" height=\"762\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/graphical-layout-editor3.jpg 672w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/graphical-layout-editor3-264x300.jpg 264w\" sizes=\"(max-width: 672px) 100vw, 672px\" \/><\/a><\/p>\n<h3>4. Adding a ClickListener to a checkbox and to the Button<\/h3>\n<p>Go to the java file that contains the code of the activity you\u2019ve just created and paste the following code:<\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.android.checkboxexample;\r\n\r\nimport android.app.Activity;\r\nimport android.os.Bundle;\r\nimport android.view.View;\r\nimport android.view.View.OnClickListener;\r\nimport android.widget.Button;\r\nimport android.widget.CheckBox;\r\nimport android.widget.Toast;\r\n\r\npublic class MainActivity extends Activity {\r\n\r\n  private CheckBox linux, macos, windows;\r\n  private Button button;\r\n\r\n  @Override\r\n  public void onCreate(Bundle savedInstanceState) {\r\n\tsuper.onCreate(savedInstanceState);\r\n\tsetContentView(R.layout.main);\r\n\r\n\taddListenerOnChkWindows();\r\n\taddListenerOnButton();\r\n  }\r\n\r\n  public void addListenerOnChkWindows() {\r\n\r\n\twindows = (CheckBox) findViewById(R.id.windows_option);\r\n\r\n\twindows.setOnClickListener(new OnClickListener() {\r\n\r\n\t  @Override\r\n\t  public void onClick(View v) {\r\n\r\n\t\tif (((CheckBox) v).isChecked()) {\r\n\t\t\tToast.makeText(MainActivity.this,\"Bro, try Linux :)\", Toast.LENGTH_LONG).show();\r\n\t\t}\r\n\r\n\t  }\r\n\t});\r\n\r\n  }\r\n\r\n  public void addListenerOnButton() {\r\n\r\n\tlinux = (CheckBox) findViewById(R.id.linux_option);\r\n\tmacos = (CheckBox) findViewById(R.id.macos_option);\r\n\twindows = (CheckBox) findViewById(R.id.windows_option);\r\n\tbutton = (Button) findViewById(R.id.button);\r\n\r\n\tbutton.setOnClickListener(new OnClickListener() {\r\n\r\n\t  @Override\r\n\t  public void onClick(View v) {\r\n\r\n\t\tStringBuffer result = new StringBuffer();\r\n\t\tresult.append(\"Linux check : \").append(linux.isChecked());\r\n\t\tresult.append(\"\\nMac OS check : \").append(macos.isChecked());\r\n\t\tresult.append(\"\\nWindows check :\").append(windows.isChecked());\r\n\r\n\t\tToast.makeText(MainActivity.this, result.toString(), Toast.LENGTH_LONG).show();\r\n\r\n\t  }\r\n\t});\r\n\r\n  }\r\n}<\/pre>\n<p>The above code adds two <code>ClickListeners<\/code>. So:<\/p>\n<ol>\n<li>If the checkbox component with id &#8220;windows_option&#8221; was clicked, a message suggesting to use Linux :) will be displayed.<\/li>\n<li>If the button was pressed, display a message reflecting the status of the checkboxes.<\/li>\n<\/ol>\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\/2012\/12\/main-screen1.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1331\" title=\"main-screen\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/main-screen1.jpg\" alt=\"\" width=\"256\" height=\"470\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/main-screen1.jpg 256w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/main-screen1-163x300.jpg 163w\" sizes=\"(max-width: 256px) 100vw, 256px\" \/><\/a><\/p>\n<p>When we check the Windows option:<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/try-linux-screen1.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1332\" title=\"try-linux-screen\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/try-linux-screen1.jpg\" alt=\"\" width=\"256\" height=\"470\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/try-linux-screen1.jpg 256w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/try-linux-screen1-163x300.jpg 163w\" sizes=\"(max-width: 256px) 100vw, 256px\" \/><\/a><\/p>\n<p>And when we press the Button :<\/p>\n<p><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/checkbox-status.jpg\"><img decoding=\"async\" class=\"alignnone size-full wp-image-1333\" title=\"checkbox-status\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/checkbox-status.jpg\" alt=\"\" width=\"256\" height=\"470\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/checkbox-status.jpg 256w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/checkbox-status-163x300.jpg 163w\" sizes=\"(max-width: 256px) 100vw, 256px\" \/><\/a><\/p>\n<h3>Download Eclipse Project<\/h3>\n<p>This was an Android Checkbox Example. Download the Eclipse Project of this tutorial:\u00a0<a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/AndroidCheckboxExample.zip\">AndroidCheckboxExample.zip<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the\u00a0easiest and most common\u00a0ways to accept user input in an Android Application is the Checkbox component. In this tutorial we are going to see how to set up and display a checkbox list with some options for the user. Furthermore, we are going to use a button that when it&#8217;s pressed, a message &hellip;<\/p>\n","protected":false},"author":7,"featured_media":1202,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[331],"tags":[266,265,267],"class_list":["post-1310","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-checkbox-ui","tag-android-checkbox","tag-android-core","tag-android-ui"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Android Checkbox Example<\/title>\n<meta name=\"description\" content=\"One of the\u00a0easiest and most common\u00a0ways to accept user input in an Android Application is the Checkbox component. In this tutorial we are going to see how\" \/>\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\/ui\/checkbox-ui\/android-checkbox-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android Checkbox Example\" \/>\n<meta property=\"og:description\" content=\"One of the\u00a0easiest and most common\u00a0ways to accept user input in an Android Application is the Checkbox component. In this tutorial we are going to see how\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-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=\"2012-12-17T15:06:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-01-30T17:32:01+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=\"Ilias Tsagklis\" \/>\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=\"Ilias Tsagklis\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 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\/ui\/checkbox-ui\/android-checkbox-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/\"},\"author\":{\"name\":\"Ilias Tsagklis\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/ca18b1aa108e3bfadf717e563e0a7a6e\"},\"headline\":\"Android Checkbox Example\",\"datePublished\":\"2012-12-17T15:06:09+00:00\",\"dateModified\":\"2013-01-30T17:32:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/\"},\"wordCount\":509,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"keywords\":[\"Android Checkbox\",\"Android Core\",\"Android UI\"],\"articleSection\":[\"CheckBox\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/\",\"name\":\"Android Checkbox Example\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"datePublished\":\"2012-12-17T15:06:09+00:00\",\"dateModified\":\"2013-01-30T17:32:01+00:00\",\"description\":\"One of the\u00a0easiest and most common\u00a0ways to accept user input in an Android Application is the Checkbox component. In this tutorial we are going to see how\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-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\/ui\/checkbox-ui\/android-checkbox-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\":\"ui\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/ui\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"CheckBox\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/ui\/checkbox-ui\/\"},{\"@type\":\"ListItem\",\"position\":6,\"name\":\"Android Checkbox 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\/ca18b1aa108e3bfadf717e563e0a7a6e\",\"name\":\"Ilias Tsagklis\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/Ilias-Tsagklis_avatar_1454249217-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/Ilias-Tsagklis_avatar_1454249217-96x96.jpg\",\"caption\":\"Ilias Tsagklis\"},\"description\":\"Ilias is a software developer turned online entrepreneur. He is co-founder and Executive Editor at Java Code Geeks.\",\"sameAs\":[\"http:\/\/www.iliastsagklis.com\/\",\"https:\/\/www.linkedin.com\/in\/iliastsagklis\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/ilias-tsagklis\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android Checkbox Example","description":"One of the\u00a0easiest and most common\u00a0ways to accept user input in an Android Application is the Checkbox component. In this tutorial we are going to see how","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\/ui\/checkbox-ui\/android-checkbox-example\/","og_locale":"en_US","og_type":"article","og_title":"Android Checkbox Example","og_description":"One of the\u00a0easiest and most common\u00a0ways to accept user input in an Android Application is the Checkbox component. In this tutorial we are going to see how","og_url":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2012-12-17T15:06:09+00:00","article_modified_time":"2013-01-30T17:32:01+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":"Ilias Tsagklis","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Ilias Tsagklis","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/"},"author":{"name":"Ilias Tsagklis","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/ca18b1aa108e3bfadf717e563e0a7a6e"},"headline":"Android Checkbox Example","datePublished":"2012-12-17T15:06:09+00:00","dateModified":"2013-01-30T17:32:01+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/"},"wordCount":509,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","keywords":["Android Checkbox","Android Core","Android UI"],"articleSection":["CheckBox"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/","url":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/","name":"Android Checkbox Example","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","datePublished":"2012-12-17T15:06:09+00:00","dateModified":"2013-01-30T17:32:01+00:00","description":"One of the\u00a0easiest and most common\u00a0ways to accept user input in an Android Application is the Checkbox component. In this tutorial we are going to see how","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/ui\/checkbox-ui\/android-checkbox-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\/ui\/checkbox-ui\/android-checkbox-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":"ui","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/ui\/"},{"@type":"ListItem","position":5,"name":"CheckBox","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/ui\/checkbox-ui\/"},{"@type":"ListItem","position":6,"name":"Android Checkbox 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\/ca18b1aa108e3bfadf717e563e0a7a6e","name":"Ilias Tsagklis","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/Ilias-Tsagklis_avatar_1454249217-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/Ilias-Tsagklis_avatar_1454249217-96x96.jpg","caption":"Ilias Tsagklis"},"description":"Ilias is a software developer turned online entrepreneur. He is co-founder and Executive Editor at Java Code Geeks.","sameAs":["http:\/\/www.iliastsagklis.com\/","https:\/\/www.linkedin.com\/in\/iliastsagklis"],"url":"https:\/\/examples.javacodegeeks.com\/author\/ilias-tsagklis\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1310","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\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=1310"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/1310\/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=1310"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=1310"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=1310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}