

{"id":76996,"date":"2020-03-16T11:44:09","date_gmt":"2020-03-16T06:14:09","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=76996"},"modified":"2021-02-25T16:06:26","modified_gmt":"2021-02-25T10:36:26","slug":"android-radiobutton","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/android-radiobutton\/","title":{"rendered":"Android RadioButton, RadioGroup, and CheckBox &#8211; A Complete Guide"},"content":{"rendered":"<p>In this tutorial, we will learn about the concept of<strong> Android RadioButton, RadioGroup, and Android checkbox<\/strong> with their implementation.<\/p>\n<h2>Introduction to Android RadioButton<\/h2>\n<p>Beginning with <strong>Android RadioButton<\/strong>, A RadioButton is a button that has two states, that are either check or uncheck. This means if we click on a RadioButton it gets into Checked state and by default, it comes in Unchecked State.<\/p>\n<p>In the Android Radio button, one thing to be noted is, once it gets into the checked state we cannot undo it. Generally, we use them in our application to let the users select one option from a set of options.\u00a0Radio Button is one of the important Android UI controls, as it provides an interactive User Interface for the users.<\/p>\n<p><strong><em>Learn to use<a href=\"https:\/\/data-flair.training\/blogs\/android-ui-controls\/\"> UI controls<\/a> to create an attractive design for your application.<\/em><\/strong><\/p>\n<p>To create it, we define it in our layout file as:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;RadioButton\r\n      android: text= \u201cI am a button\u201d\r\n      android: id= \u201c@+id\/rdb\u201d\r\n      \/\/ other attributes\r\n&gt;<\/pre>\n<h3>Attributes of Android RadioButton<\/h3>\n<p>Some of the attributes that we can use to customize the RadioButton in Android are as follows:<\/p>\n<ol>\n<li><strong>android: id &#8211;<\/strong>\u00a0It set a unique identity.<\/li>\n<li><strong>android: checked &#8211;<\/strong> It specifies the current state of the button.<\/li>\n<li><strong>android: gravity &#8211;<\/strong> It sets the alignment of the text.<\/li>\n<li><strong>android: text &#8211;<\/strong> It sets the text for the Radio Button.<\/li>\n<li><strong>android:textColor &#8211;<\/strong> It sets the color of the text.<\/li>\n<li><strong>android:textSize &#8211;<\/strong> It sets the size of the text.<\/li>\n<li><strong>android:textStyle &#8211;<\/strong> It sets the style of the text, like &#8211; bold, italics.<\/li>\n<li><strong>android: background &#8211;<\/strong> It sets the color for the background of the button.<\/li>\n<li><strong>android: padding &#8211;<\/strong> It sets the padding from left, right bottom or the top.<\/li>\n<li><strong>android:onClick &#8211;<\/strong> It invokes the method onClick() when the button is clicked.<\/li>\n<li><strong>android: visibility &#8211;<\/strong> It controls the visibility of the Radio Button.<\/li>\n<\/ol>\n<h3>RadioGroup in Android<\/h3>\n<p>Radio Group in Android is a group that contains a set of radio buttons. They contain Radio buttons in a group or in separate groups according to the requirement. The specialty of a Radio group is, among all the available Radio buttons inside it, only one can be chosen. After selecting a Radio button if we select some other Radio button, then the previous one gets deselected.<\/p>\n<p>Their need is basically to select one right option among all the other available options. For example, Multiple Choice Questions.<\/p>\n<p>To define it in our layout file, we will write the following:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;RadioGroup\r\n      android:layout_width=\"fill_parent\"\r\n      android:layout_height=\"90dp\"&gt;\r\n\r\n      &lt;RadioButton\r\n         android:id=\"@+id\/rdb\"\r\n         android:layout_width=\"wrap_content\"\r\n         android:layout_height=\"55dp\"\r\n         android:text=\"RadioButton1\"\r\n         android:textSize=\"25dp\" \/&gt;\r\n\r\n      &lt;RadioButton\r\n         android:id=\"@+id\/rdb1\"\r\n         android:layout_width=\"wrap_content\"\r\n         android:layout_height=\"wrap_content\"\r\n         android:text=\"RadioButton2\"\r\n         android:textSize=\"25dp\" \/&gt;\r\n   &lt;\/RadioGroup&gt;<\/pre>\n<h3>CheckBox in Android<\/h3>\n<p>CheckBox is also a two-state button, it can have either checked state or unchecked state. The major difference between Android CheckBox and Android RadioButton is that checkboxes can be unchecked manually.<\/p>\n<ul>\n<li>Check means ON or True<\/li>\n<li>Uncheck means OFF or False<\/li>\n<\/ul>\n<p>Android CheckBox is mostly useful when there are multiple options &amp; the users are allowed to choose all the options that are applicable.<\/p>\n<p>To define it in the layout file, we will write the code as follows:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;CheckBox\r\n         android:id=\"@+id\/myCheckBoxl\"\r\n         android:layout_width=\"wrap_content\"\r\n         android:layout_height=\"wrap_content\"\r\n         android:layout_marginLeft=\"100dp\"\r\n         android:onClick=\"onCheckboxClicked\"\r\n         android:padding=\"10dp\"\r\n         android:text=\"Check Box\" \/&gt;<\/pre>\n<h4>Attributes of Android CheckBox<\/h4>\n<p>We can also set <a href=\"https:\/\/developer.android.com\/reference\/org\/xml\/sax\/Attributes\">attributes<\/a> on CheckBox to customize it in our way, using the following attributes:<\/p>\n<ol>\n<li><strong>android: id &#8211;<\/strong>\u00a0It set a unique identity<\/li>\n<li><strong>android: checked &#8211;<\/strong> It specifies the current state of the CheckBox.<\/li>\n<li><strong>android: gravity &#8211;<\/strong> It sets the alignment of the CheckBox.<\/li>\n<li><strong>android: text &#8211;<\/strong> It sets the text for the Radio CheckBox.<\/li>\n<li><strong>android:textColor &#8211;<\/strong> It sets the color of the text in the CheckBox.<\/li>\n<li><strong>android:textSize &#8211;<\/strong> It sets the size of the text in CheckBox.<\/li>\n<li><strong>android:textStyle &#8211;<\/strong> It sets the style of the text, like &#8211; bold, italics.<\/li>\n<li><strong>android: background &#8211;<\/strong> It sets the color for the background of the CheckBox.<\/li>\n<li><strong>android: padding &#8211;<\/strong> It sets the padding from left, right bottom or the top.<\/li>\n<li><strong>android:onClick &#8211;<\/strong> It invokes the method onClick() when the button is clicked.<\/li>\n<li><strong>android: visibility &#8211;<\/strong> It controls the visibility of the CheckBox.<\/li>\n<\/ol>\n<h3>Implementation of Android RadioButton and Android RadioGroup<\/h3>\n<p>Let us see the implementation of the <strong>Android Radio Button<\/strong> and<strong> Android Radio Group<\/strong> through the following example:<\/p>\n<p><strong>Step 1.<\/strong> First of all, we will create a new project and name it. After this, we will define the layout in<strong> activity_main.xml<\/strong> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;RelativeLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n   android:layout_width=\"match_parent\"\r\n   android:layout_height=\"match_parent\"&gt;\r\n\r\n   &lt;TextView\r\n       android:id=\"@+id\/textView\"\r\n       android:layout_width=\"wrap_content\"\r\n       android:layout_height=\"wrap_content\"\r\n       android:layout_centerHorizontal=\"true\"\r\n       android:layout_marginLeft=\"100dp\"\r\n       android:layout_marginTop=\"80dp\"\r\n       android:fontFamily=\"@font\/\"\r\n       android:text=\"DataFlair \"\r\n       android:textColor=\"#169179\"\r\n       android:textSize=\"50dp\"\r\n       android:textStyle=\"bold\" \/&gt;\r\n\r\n   &lt;TextView\r\n       android:id=\"@+id\/txtView\"\r\n       android:layout_width=\"wrap_content\"\r\n       android:layout_height=\"wrap_content\"\r\n       android:layout_marginLeft=\"100dp\"\r\n       android:layout_marginTop=\"150dp\"\r\n       android:text=\"Which city is Capital of India\"\r\n       android:textSize=\"18dp\" \/&gt;\r\n\r\n   &lt;RadioGroup\r\n       android:id=\"@+id\/rdGroup\"\r\n       android:layout_width=\"match_parent\"\r\n       android:layout_height=\"wrap_content\"\r\n       android:layout_below=\"@+id\/txtView\"\r\n       android:orientation=\"vertical\"&gt;\r\n\r\n       &lt;RadioButton\r\n           android:id=\"@+id\/rbDelhi\"\r\n           android:layout_width=\"wrap_content\"\r\n           android:layout_height=\"wrap_content\"\r\n           android:layout_marginLeft=\"100dp\"\r\n           android:onClick=\"onRadioButtonClicked\"\r\n           android:padding=\"10dp\"\r\n           android:text=\"Delhi\" \/&gt;\r\n\r\n       &lt;RadioButton\r\n           android:id=\"@+id\/rbmum\"\r\n           android:layout_width=\"wrap_content\"\r\n           android:layout_height=\"wrap_content\"\r\n           android:layout_marginLeft=\"100dp\"\r\n           android:onClick=\"onRadioButtonClicked\"\r\n           android:padding=\"10dp\"\r\n           android:text=\"Mumbai\" \/&gt;\r\n\r\n       &lt;RadioButton\r\n           android:id=\"@+id\/rbBhop\"\r\n           android:layout_width=\"wrap_content\"\r\n           android:layout_height=\"wrap_content\"\r\n           android:layout_marginLeft=\"100dp\"\r\n           android:onClick=\"onRadioButtonClicked\"\r\n           android:padding=\"10dp\"\r\n           android:text=\"Bhopal\" \/&gt;\r\n\r\n       &lt;RadioButton\r\n           android:id=\"@+id\/rbbang\"\r\n           android:layout_width=\"wrap_content\"\r\n           android:layout_height=\"wrap_content\"\r\n           android:layout_marginLeft=\"100dp\"\r\n           android:onClick=\"onRadioButtonClicked\"\r\n           android:padding=\"10dp\"\r\n           android:text=\"Bangalore\" \/&gt;\r\n   &lt;\/RadioGroup&gt;\r\n\r\n   &lt;Button\r\n       android:id=\"@+id\/showbtn\"\r\n       android:layout_width=\"wrap_content\"\r\n       android:layout_height=\"wrap_content\"\r\n       android:layout_below=\"@+id\/rdGroup\"\r\n       android:layout_marginLeft=\"100dp\"\r\n       android:layout_marginTop=\"12dp\"\r\n       android:text=\"Show the correct answer\" \/&gt;\r\n\r\n&lt;\/RelativeLayout&gt;<\/pre>\n<p><strong>Step 2.<\/strong> Now the thing we will do is, writing the following code in <strong>MainActivity.java<\/strong> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.dataflair.myradioandcheckbox;\r\n\r\nimport android.os.Bundle;\r\nimport android.view.View;\r\nimport android.widget.Button;\r\nimport android.widget.RadioButton;\r\nimport android.widget.Toast;\r\n\r\nimport androidx.appcompat.app.AppCompatActivity;\r\n\r\npublic class MainActivity extends AppCompatActivity {\r\n   RadioButton Bhopal, Delhi, Bangalore, Mumbai;\r\n\r\n   @Override\r\n   protected void onCreate(Bundle savedInstanceState) {\r\n       super.onCreate(savedInstanceState);\r\n       setContentView(R.layout.activity_main);\r\n       Bhopal = findViewById(R.id.rbBhop);\r\n       Bangalore = findViewById(R.id.rbbang);\r\n       Delhi = findViewById(R.id.rbDelhi);\r\n       Mumbai = findViewById(R.id.rbmum);\r\n       Button showbtn =        findViewById(R.id.showbtn);\r\n       showbtn.setOnClickListener(new View.OnClickListener() {\r\n           @Override\r\n           public void onClick(View v) {\r\n               String Res = \" Right Answer is Delhi, \";\r\n               Res += (Bhopal.isChecked()) ? \" not Bhopal\" : (Bangalore.isChecked()) ? \" not Bangalore\" : (Delhi.isChecked()) ? \" Bravo \" : (Mumbai.isChecked()) ? \" not Mumbai\" : \"\";\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Toast.makeText(getApplicationContext(), Res, Toast.LENGTH_SHORT).show();\r\n\r\n           }\r\n       });\r\n   }\r\n\r\n   public void onRadioButtonClicked(View view) {\r\n       boolean checked = ((RadioButton) view).isChecked();\r\n       String msg = \"\";\r\n       \/\/ We'll check which radiobutton is clicked\r\n       switch (view.getId()) {\r\n           case R.id.rbBhop:\r\n               if (checked)\r\n                   msg = \"You Clicked Bhopal\";\r\n               break;\r\n           case R.id.rbbang:\r\n               if (checked)\r\n                   msg = \"You Clicked Bangalore \";\r\n               break;\r\n           case R.id.rbDelhi:\r\n               if (checked)\r\n                   msg = \"You Clicked Delhi \";\r\n               break;\r\n           case R.id.rbmum:\r\n               if (checked)\r\n                   msg = \"You Clicked Mumbai\";\r\n               break;\r\n       }\r\n       Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();\r\n   }\r\n}<\/pre>\n<p><strong>Step 3.<\/strong> Now we will run this:<\/p>\n<p><strong>i)<\/strong> This is the implementation of the Radio Button and Radio Group.<a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Radio-button.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-77133 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Radio-button.png\" alt=\"Implementation of Android RadioButton and RadioGroup\" width=\"300\" height=\"533\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Radio-button.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Radio-button-84x150.png 84w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Radio-button-169x300.png 169w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong>ii)<\/strong> Here, I clicked Mumbai and then pressed the button.<a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/radio-button.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-77138 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/radio-button.png\" alt=\"Select Mumbai in Android RadioButton\" width=\"300\" height=\"533\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/radio-button.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/radio-button-84x150.png 84w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/radio-button-169x300.png 169w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong>iii)<\/strong> After I pressed the button, It generated a toast message.<a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Radio-Button.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-77146 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Radio-Button.png\" alt=\"Generation of toast message in Android RadioGroup\" width=\"300\" height=\"533\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Radio-Button.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Radio-Button-84x150.png 84w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Radio-Button-169x300.png 169w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong>iv)<\/strong> This is where Radio Group works. Earlier Mumbai was checked, as soon as I checked Delhi, Mumbai got unchecked.<a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Radio-button.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-77175 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Radio-button.jpg\" alt=\"implementation of Android RadioGroup\" width=\"300\" height=\"533\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Radio-button.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Radio-button-84x150.jpg 84w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Radio-button-169x300.jpg 169w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong>v)<\/strong> To see how Radio Group works, see this:<a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/radio-button.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-77176 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/radio-button.gif\" alt=\"Working of RadioGroup in android\" width=\"332\" height=\"694\" \/><\/a><\/p>\n<h3>Implementation of CheckBox in Android<\/h3>\n<p>Let us now see the example for the implementation of <strong>CheckBox<\/strong> in our application:<\/p>\n<p><strong>Step 1:<\/strong> To implement it as always, we will first create a new project. Now we will define the CheckBox in <strong>activity_main.xml<\/strong> file as follows:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&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=\"match_parent\"\r\n   android:layout_height=\"match_parent\"\r\n   android:orientation=\"vertical\"&gt;\r\n\r\n\r\n   &lt;TextView\r\n       android:id=\"@+id\/textView\"\r\n       android:layout_width=\"wrap_content\"\r\n       android:layout_height=\"wrap_content\"\r\n       android:layout_centerHorizontal=\"true\"\r\n       android:layout_marginLeft=\"100dp\"\r\n       android:layout_marginTop=\"80dp\"\r\n       android:fontFamily=\"@font\/\"\r\n       android:text=\"DataFlair \"\r\n       android:textColor=\"#169179\"\r\n       android:textSize=\"50dp\"\r\n       android:textStyle=\"bold\" \/&gt;\r\n\r\n   &lt;TextView\r\n       android:layout_width=\"wrap_content\"\r\n       android:layout_height=\"wrap_content\"\r\n       android:layout_marginLeft=\"100dp\"\r\n       android:text=\"Choose your favourite cities \"\r\n       android:textColor=\"#169179\"\r\n       android:textSize=\"15dp\"\r\n       android:textStyle=\"bold\" \/&gt;\r\n\r\n   &lt;CheckBox\r\n       android:id=\"@+id\/myDel\"\r\n       android:layout_width=\"wrap_content\"\r\n       android:layout_height=\"wrap_content\"\r\n       android:layout_marginLeft=\"100dp\"\r\n       android:onClick=\"onCheckboxClicked\"\r\n       android:padding=\"10dp\"\r\n       android:text=\"Delhi\" \/&gt;\r\n\r\n   &lt;CheckBox\r\n       android:id=\"@+id\/myBang\"\r\n       android:layout_width=\"wrap_content\"\r\n       android:layout_height=\"wrap_content\"\r\n       android:layout_marginLeft=\"100dp\"\r\n       android:onClick=\"onCheckboxClicked\"\r\n       android:padding=\"10dp\"\r\n       android:text=\"Bangalore\" \/&gt;\r\n\r\n   &lt;CheckBox\r\n       android:id=\"@+id\/myPun\"\r\n       android:layout_width=\"wrap_content\"\r\n       android:layout_height=\"wrap_content\"\r\n       android:layout_marginLeft=\"100dp\"\r\n       android:onClick=\"onCheckboxClicked\"\r\n       android:padding=\"10dp\"\r\n       android:text=\"Pune\" \/&gt;\r\n\r\n   &lt;CheckBox\r\n       android:id=\"@+id\/mymum\"\r\n       android:layout_width=\"wrap_content\"\r\n       android:layout_height=\"wrap_content\"\r\n       android:layout_marginLeft=\"100dp\"\r\n       android:onClick=\"onCheckboxClicked\"\r\n       android:padding=\"10dp\"\r\n       android:text=\"Mumbai\" \/&gt;\r\n   &lt;CheckBox\r\n       android:id=\"@+id\/myShimla\"\r\n       android:layout_width=\"wrap_content\"\r\n       android:layout_height=\"wrap_content\"\r\n       android:layout_marginLeft=\"100dp\"\r\n       android:onClick=\"onCheckboxClicked\"\r\n       android:padding=\"10dp\"\r\n       android:text=\"Shimla\" \/&gt;\r\n\r\n   &lt;Button\r\n       android:id=\"@+id\/showBtn\"\r\n       android:layout_width=\"wrap_content\"\r\n       android:layout_height=\"wrap_content\"\r\n       android:layout_marginLeft=\"100dp\"\r\n       android:text=\"show me\" \/&gt;\r\n&lt;\/LinearLayout&gt;<\/pre>\n<p><strong>Step 2:<\/strong> Now we will write the following code in <strong>MainActivity.java<\/strong> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.DataFlair.mycheckbox;\r\n\r\nimport android.os.Bundle;\r\nimport android.view.View;\r\nimport android.widget.Button;\r\nimport android.widget.CheckBox;\r\nimport android.widget.Toast;\r\n\r\nimport androidx.appcompat.app.AppCompatActivity;\r\n\r\npublic class MainActivity extends AppCompatActivity {\r\n   CheckBox Pun, Del, Mum, Bang, Shim;\r\n\r\n   @Override\r\n\r\n   protected void onCreate(Bundle savedInstanceState) {\r\n       super.onCreate(savedInstanceState);\r\n       setContentView(R.layout.activity_main);\r\n       Pun = findViewById(R.id.myPun);\r\n       Mum = findViewById(R.id.mymum);\r\n       Del = findViewById(R.id.myDel);\r\n       Bang = findViewById(R.id.myBang);\r\n       Shim = findViewById(R.id.myShimla);\r\n       Button showbtn = findViewById(R.id.showBtn);\r\n       showbtn.setOnClickListener(new View.OnClickListener() {\r\n           @Override\r\n           public void onClick(View v) {\r\n               String Res = \"Favourite cities\";\r\n               if (Pun.isChecked()) {\r\n                   Res += \"\\n Pune\";\r\n               }\r\n               if (Mum.isChecked()) {\r\n                   Res += \"\\n Mumbai\";\r\n               }\r\n               if (Del.isChecked()) {\r\n                   Res += \"\\n Delhi\";\r\n               }\r\n               if (Bang.isChecked()) {\r\n                   Res += \"\\n Bangalore\";\r\n               }\r\n               if (Shim.isChecked()) {\r\n                   Res += \"\\n Shimla\";\r\n               }\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Toast.makeText(getApplicationContext(), Res, Toast.LENGTH_SHORT).show();\r\n           }\r\n       });\r\n   }\r\n\r\n   public void onCheckboxClicked(View view) {\r\n       boolean checked = ((CheckBox) view).isChecked();\r\n       String msg = \"\";\r\n       switch (view.getId()) {\r\n           case R.id.myPun:\r\n               msg = checked ? \"Pune Selected\" : \"Pune Deselected\";\r\n               break;\r\n           case R.id.mymum:\r\n               msg = checked ? \"Mumbai Selected\" : \"Mumbai Deselected\";\r\n               break;\r\n           case R.id.myDel:\r\n               msg = checked ? \"Delhi Selected\" : \"Delhi Deselected\";\r\n               break;\r\n           case R.id.myBang:\r\n               msg = checked ? \"Bangalore Selected\" : \"Bangalore Deselected\";\r\n               break;\r\n           case R.id.myShimla:\r\n               msg = checked ? \"Shimla Selected\" : \"Shimla Deselected\";\r\n               break;\r\n       }\r\n       Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();\r\n   }\r\n}<\/pre>\n<p><strong>Step 3:<\/strong> Now we will run the code as follows:<\/p>\n<p><strong>i)<\/strong> The following would be the CheckBox in our app:<a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/checkbox-in-android.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-77147 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/checkbox-in-android.png\" alt=\"Checkbox in Android application\" width=\"300\" height=\"533\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/checkbox-in-android.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/checkbox-in-android-84x150.png 84w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/checkbox-in-android-169x300.png 169w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong>ii)<\/strong> We will select the cities now:<\/p>\n<p><strong>a.<\/strong> First selecting Shimla:<a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-checkbox.png\"><br \/>\n<\/a><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Android-Checkbox.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-77239 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Android-Checkbox.png\" alt=\"Selecting shimla in checkbox\" width=\"300\" height=\"533\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Android-Checkbox.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Android-Checkbox-84x150.png 84w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Android-Checkbox-169x300.png 169w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong>b.<\/strong>\u00a0Since it is a Checkbox, we will select Mumbai as well:<strong><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-checkbox-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-77240 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-checkbox-1.png\" alt=\"Mumbai selected in checkbox\" width=\"300\" height=\"533\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-checkbox-1.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-checkbox-1-84x150.png 84w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-checkbox-1-169x300.png 169w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/strong><\/p>\n<p><strong>iii)<\/strong> As we can select more than one option as well, here are the selected cities. For that, click on\u00a0 \u00a0 \u00a0 \u201cSHOW ME\u201d &#8211;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/checkbox-android-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-77241 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/checkbox-android-1.png\" alt=\"Showing favourite cities in checkbox\" width=\"300\" height=\"533\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/checkbox-android-1.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/checkbox-android-1-84x150.png 84w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/checkbox-android-1-169x300.png 169w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h2>Summary<\/h2>\n<p>In this tutorial, we saw quite a good number of interesting things including Android Radiobutton, Radio Group, and CheckBox. We saw how we can customize them and how well we can use them in our application. Then, we also implemented an example of those to understand them better. So, now it is your time to implement them in your applications.<\/p>\n<p>I hope you liked the tutorial, if you have any queries about the Android Radiobutton, RadioGroup &amp; CheckBox, please ask in the comment section. Our experts will get back to you.<\/p>\n<p>Happy Learning\ud83d\ude03<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;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-14 09:45:21&quot;,&quot;http_code&quot;:503},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, we will learn about the concept of Android RadioButton, RadioGroup, and Android checkbox with their implementation. Introduction to Android RadioButton Beginning with Android RadioButton, A RadioButton is a button that has&#46;&#46;&#46;<\/p>\n","protected":false},"author":7,"featured_media":77155,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18722],"tags":[22115,22111,22113,22117,22116,22114,22110,22112],"class_list":["post-76996","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","tag-android-checkbox","tag-android-radiobutton","tag-android-radiogroup","tag-attributes-of-android-checkbox","tag-attributes-of-android-radiobutton","tag-checkbox-in-android","tag-radiobutton-in-android","tag-radiogroup-in-android"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Android RadioButton, RadioGroup, and CheckBox - A Complete Guide - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn the concept of Android RadioButton, RadioGroup, &amp; CheckBox with the help of examples. Also, explore the various attributes and implementation of Android RadioButton, RadioGroup, &amp; CheckBox.\" \/>\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-radiobutton\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android RadioButton, RadioGroup, and CheckBox - A Complete Guide - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn the concept of Android RadioButton, RadioGroup, &amp; CheckBox with the help of examples. Also, explore the various attributes and implementation of Android RadioButton, RadioGroup, &amp; CheckBox.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/android-radiobutton\/\" \/>\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-03-16T06:14:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-02-25T10:36:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-radiogroup-checkbox.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=\"10 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android RadioButton, RadioGroup, and CheckBox - A Complete Guide - DataFlair","description":"Learn the concept of Android RadioButton, RadioGroup, & CheckBox with the help of examples. Also, explore the various attributes and implementation of Android RadioButton, RadioGroup, & CheckBox.","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-radiobutton\/","og_locale":"en_US","og_type":"article","og_title":"Android RadioButton, RadioGroup, and CheckBox - A Complete Guide - DataFlair","og_description":"Learn the concept of Android RadioButton, RadioGroup, & CheckBox with the help of examples. Also, explore the various attributes and implementation of Android RadioButton, RadioGroup, & CheckBox.","og_url":"https:\/\/data-flair.training\/blogs\/android-radiobutton\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2020-03-16T06:14:09+00:00","article_modified_time":"2021-02-25T10:36:26+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-radiogroup-checkbox.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":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/android-radiobutton\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/android-radiobutton\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd"},"headline":"Android RadioButton, RadioGroup, and CheckBox &#8211; A Complete Guide","datePublished":"2020-03-16T06:14:09+00:00","dateModified":"2021-02-25T10:36:26+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/android-radiobutton\/"},"wordCount":986,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/android-radiobutton\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-radiogroup-checkbox.jpg","keywords":["Android CheckBox","Android RadioButton","Android RadioGroup","Attributes of Android CheckBox","Attributes of Android RadioButton","CheckBox in Android","RadioButton in Android","RadioGroup in Android"],"articleSection":["Android Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/android-radiobutton\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/android-radiobutton\/","url":"https:\/\/data-flair.training\/blogs\/android-radiobutton\/","name":"Android RadioButton, RadioGroup, and CheckBox - A Complete Guide - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/android-radiobutton\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/android-radiobutton\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-radiogroup-checkbox.jpg","datePublished":"2020-03-16T06:14:09+00:00","dateModified":"2021-02-25T10:36:26+00:00","description":"Learn the concept of Android RadioButton, RadioGroup, & CheckBox with the help of examples. Also, explore the various attributes and implementation of Android RadioButton, RadioGroup, & CheckBox.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/android-radiobutton\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/android-radiobutton\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/android-radiobutton\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-radiogroup-checkbox.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-radiogroup-checkbox.jpg","width":802,"height":420,"caption":"Radio button in android"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/android-radiobutton\/#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 RadioButton, RadioGroup, and CheckBox &#8211; A Complete Guide"}]},{"@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\/76996","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=76996"}],"version-history":[{"count":18,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/76996\/revisions"}],"predecessor-version":[{"id":77242,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/76996\/revisions\/77242"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/77155"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=76996"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=76996"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=76996"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}