SlideShare une entreprise Scribd logo
1  sur  5
Télécharger pour lire hors ligne
Android App with Radio button group – NITHIYAPRIYA PASAVARAJ
Android Application with Radio Button
Activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<LinearLayout
android:id="@+id/lnrlayout"
android:layout_width="fill_parent"
android:layout_height="756dp"
android:orientation="vertical">
<TextView
android:id="@+id/textView2"
Android App with Radio button group – NITHIYAPRIYA PASAVARAJ
android:layout_width="wrap_content"
android:layout_height="72dp"
android:text="Select Your Favorite Color"
android:textColor="#7B1FA2"
android:textSize="30sp"
android:textStyle="bold"
tools:layout_conversion_absoluteHeight="61dp"
tools:layout_conversion_absoluteWidth="388dp"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp" />
<RadioGroup
android:layout_width="355dp"
android:layout_height="397dp">
<RadioButton
android:id="@+id/clrred"
android:layout_width="match_parent"
android:layout_height="47dp"
android:layout_weight="1"
android:checked="false"
android:text="Red"
android:textAllCaps="true"
android:textColor="#E64A19"
android:textSize="24sp"
android:textStyle="bold|italic" />
<RadioButton
android:id="@+id/clrblue"
android:layout_width="match_parent"
android:layout_height="43dp"
android:layout_weight="1"
android:checked="false"
android:text="Blue"
android:textAllCaps="true"
android:textColor="#512DA8"
android:textSize="24sp"
android:textStyle="bold|italic" />
<RadioButton
android:id="@+id/clrgreen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Android App with Radio button group – NITHIYAPRIYA PASAVARAJ
android:layout_weight="1"
android:text="Green"
android:textAllCaps="true"
android:textColor="#00796B"
android:textSize="24sp"
android:textStyle="bold|italic" />
<RadioButton
android:id="@+id/clryellow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Yellow"
android:textAllCaps="true"
android:textColor="#FBC02D"
android:textSize="24sp"
android:textStyle="bold|italic" />
<RadioButton
android:id="@+id/clrorange"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Gray"
android:textAllCaps="true"
android:textColor="#A3A39F"
android:textSize="24sp"
android:textStyle="bold|italic" />
</RadioGroup>
<Button
android:id="@+id/btnsubmit"
android:layout_width="180dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:background="#9DC218"
android:text="Submit"
android:textAllCaps="true"
android:textColor="#7B1FA2"
android:textSize="30sp"
android:textStyle="bold" />
Android App with Radio button group – NITHIYAPRIYA PASAVARAJ
<TextView
android:id="@+id/txtview"
android:layout_width="match_parent"
android:layout_height="132dp"
android:textSize="30sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
Mainactivity.java
package com.example.radiobtngrp;
import androidx.appcompat.app.AppCompatActivity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
RadioButton red,blue,green,yellow,orange;
Button btnsubmit;
TextView txtview;
LinearLayout lnrlayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
red=(RadioButton )findViewById(R.id.clrred);
blue = (RadioButton)findViewById(R.id.clrblue);
green = (RadioButton)findViewById(R.id.clrgreen);
orange = (RadioButton)findViewById(R.id.clrorange);
yellow = (RadioButton)findViewById(R.id.clryellow);
btnsubmit = (Button)findViewById(R.id.btnsubmit);
txtview = (TextView)findViewById(R.id.txtview) ;
lnrlayout = (LinearLayout) findViewById(R.id.lnrlayout);
btnsubmit.setOnClickListener(new View.OnClickListener() {
@Override
Android App with Radio button group – NITHIYAPRIYA PASAVARAJ
public void onClick(View view) {
if(red.isChecked())
{
txtview.setText("You've Selected Red");
lnrlayout.setBackgroundColor(Color.RED);
}
if(blue.isChecked())
{
txtview.setText("You've Selected Blue");
lnrlayout.setBackgroundColor(Color.BLUE);
}
if(green.isChecked())
{
txtview.setText("You've Selected Green");
lnrlayout.setBackgroundColor(Color.GREEN);
}
if(yellow.isChecked())
{
txtview.setText("You've Selected Yellow");
lnrlayout.setBackgroundColor(Color.YELLOW);
}
if(orange.isChecked())
{
txtview.setText("You've Selected Gray");
lnrlayout.setBackgroundColor(Color.DKGRAY);
//lnrlayout.setBackgroundColor(-565);
}
}
});
}
}

Contenu connexe

Tendances

Deep Link (to the Future)
Deep Link (to the Future)Deep Link (to the Future)
Deep Link (to the Future)Akash Gupta
 
Apple Watch App Concepts
Apple Watch App ConceptsApple Watch App Concepts
Apple Watch App ConceptsJose Coronado
 
Piecing Together Azure App Service
Piecing Together Azure App ServicePiecing Together Azure App Service
Piecing Together Azure App ServiceNorseDisc
 
Appush Hands On
Appush Hands OnAppush Hands On
Appush Hands Onappush
 
One-Pager: App Intelligence
One-Pager: App IntelligenceOne-Pager: App Intelligence
One-Pager: App IntelligenceWes McCabe
 
Getting started with Google Android - OSCON 2008
Getting started with Google Android - OSCON 2008Getting started with Google Android - OSCON 2008
Getting started with Google Android - OSCON 2008sullis
 
Api design best practices from a hacker's view
Api design best practices   from a hacker's viewApi design best practices   from a hacker's view
Api design best practices from a hacker's viewhe sicong
 
Tools to make killer apps: Quick guide for developers
Tools to make killer apps: Quick guide for developersTools to make killer apps: Quick guide for developers
Tools to make killer apps: Quick guide for developersDeepak Abbot
 
Scrap the Big Launch, Fly a Kite
Scrap the Big Launch, Fly a KiteScrap the Big Launch, Fly a Kite
Scrap the Big Launch, Fly a KiteAditi Vora
 

Tendances (11)

Deep Link (to the Future)
Deep Link (to the Future)Deep Link (to the Future)
Deep Link (to the Future)
 
Spotify Apps
Spotify AppsSpotify Apps
Spotify Apps
 
Apple Watch App Concepts
Apple Watch App ConceptsApple Watch App Concepts
Apple Watch App Concepts
 
Piecing Together Azure App Service
Piecing Together Azure App ServicePiecing Together Azure App Service
Piecing Together Azure App Service
 
Appush Hands On
Appush Hands OnAppush Hands On
Appush Hands On
 
One-Pager: App Intelligence
One-Pager: App IntelligenceOne-Pager: App Intelligence
One-Pager: App Intelligence
 
App Deep Linking
App Deep LinkingApp Deep Linking
App Deep Linking
 
Getting started with Google Android - OSCON 2008
Getting started with Google Android - OSCON 2008Getting started with Google Android - OSCON 2008
Getting started with Google Android - OSCON 2008
 
Api design best practices from a hacker's view
Api design best practices   from a hacker's viewApi design best practices   from a hacker's view
Api design best practices from a hacker's view
 
Tools to make killer apps: Quick guide for developers
Tools to make killer apps: Quick guide for developersTools to make killer apps: Quick guide for developers
Tools to make killer apps: Quick guide for developers
 
Scrap the Big Launch, Fly a Kite
Scrap the Big Launch, Fly a KiteScrap the Big Launch, Fly a Kite
Scrap the Big Launch, Fly a Kite
 

Similaire à Android LAb - Creating an android app with Radio button

Invading the home screen
Invading the home screenInvading the home screen
Invading the home screenMatteo Bonifazi
 
Support Design Library
Support Design LibrarySupport Design Library
Support Design LibraryTaeho Kim
 
Practical 14 android.docx
Practical 14 android.docxPractical 14 android.docx
Practical 14 android.docxVedantIbitwar
 
Share kmu itbz_20181106
Share kmu itbz_20181106Share kmu itbz_20181106
Share kmu itbz_20181106DongHyun Gang
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?Brenda Cook
 
android layouts
android layoutsandroid layouts
android layoutsDeepa Rani
 
Maps in android
Maps in androidMaps in android
Maps in androidSumita Das
 
4.preference management
4.preference management 4.preference management
4.preference management maamir farooq
 
Lecture #1 Creating your first android project
Lecture #1  Creating your first android projectLecture #1  Creating your first android project
Lecture #1 Creating your first android projectVitali Pekelis
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android AppsGil Irizarry
 
Android Layout
Android LayoutAndroid Layout
Android Layoutmcanotes
 
Android Tutorials - Powering with Selection Widget
Android Tutorials - Powering with Selection WidgetAndroid Tutorials - Powering with Selection Widget
Android Tutorials - Powering with Selection WidgetPrajyot Mainkar
 
Android Workshop
Android WorkshopAndroid Workshop
Android WorkshopJunda Ong
 
How to use data binding in android
How to use data binding in androidHow to use data binding in android
How to use data binding in androidInnovationM
 
Basics and different xml files used in android
Basics and different xml files used in androidBasics and different xml files used in android
Basics and different xml files used in androidMahmudul Hasan
 

Similaire à Android LAb - Creating an android app with Radio button (20)

Invading the home screen
Invading the home screenInvading the home screen
Invading the home screen
 
Support Design Library
Support Design LibrarySupport Design Library
Support Design Library
 
Layouts in android
Layouts in androidLayouts in android
Layouts in android
 
Ch2 first app
Ch2 first appCh2 first app
Ch2 first app
 
Practical 14 android.docx
Practical 14 android.docxPractical 14 android.docx
Practical 14 android.docx
 
Share kmu itbz_20181106
Share kmu itbz_20181106Share kmu itbz_20181106
Share kmu itbz_20181106
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?
 
android layouts
android layoutsandroid layouts
android layouts
 
Maps in android
Maps in androidMaps in android
Maps in android
 
4.preference management
4.preference management 4.preference management
4.preference management
 
Lecture #1 Creating your first android project
Lecture #1  Creating your first android projectLecture #1  Creating your first android project
Lecture #1 Creating your first android project
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android Apps
 
Android Layout
Android LayoutAndroid Layout
Android Layout
 
Chapter 5 - Layouts
Chapter 5 - LayoutsChapter 5 - Layouts
Chapter 5 - Layouts
 
Android Tutorials - Powering with Selection Widget
Android Tutorials - Powering with Selection WidgetAndroid Tutorials - Powering with Selection Widget
Android Tutorials - Powering with Selection Widget
 
Android Workshop
Android WorkshopAndroid Workshop
Android Workshop
 
06 UI Layout
06 UI Layout06 UI Layout
06 UI Layout
 
How to use data binding in android
How to use data binding in androidHow to use data binding in android
How to use data binding in android
 
Hierarchy viewer
Hierarchy viewerHierarchy viewer
Hierarchy viewer
 
Basics and different xml files used in android
Basics and different xml files used in androidBasics and different xml files used in android
Basics and different xml files used in android
 

Plus de priya Nithya

Android Architecture.pptx
Android Architecture.pptxAndroid Architecture.pptx
Android Architecture.pptxpriya Nithya
 
Html server control - ASP. NET with c#
Html server control - ASP. NET with c#Html server control - ASP. NET with c#
Html server control - ASP. NET with c#priya Nithya
 
Modes of transfer - Computer Organization & Architecture - Nithiyapriya Pasav...
Modes of transfer - Computer Organization & Architecture - Nithiyapriya Pasav...Modes of transfer - Computer Organization & Architecture - Nithiyapriya Pasav...
Modes of transfer - Computer Organization & Architecture - Nithiyapriya Pasav...priya Nithya
 
Asynchronous data transfer
Asynchronous data transferAsynchronous data transfer
Asynchronous data transferpriya Nithya
 
Asp.net state management
Asp.net state managementAsp.net state management
Asp.net state managementpriya Nithya
 
HTTP REQUEST RESPONSE OBJECT - WEB APPLICATION USING C# LAB
HTTP REQUEST RESPONSE OBJECT - WEB APPLICATION USING C# LABHTTP REQUEST RESPONSE OBJECT - WEB APPLICATION USING C# LAB
HTTP REQUEST RESPONSE OBJECT - WEB APPLICATION USING C# LABpriya Nithya
 
HTML SERVER CONTROL - ASP.NET WITH C#
HTML SERVER CONTROL  - ASP.NET WITH C#HTML SERVER CONTROL  - ASP.NET WITH C#
HTML SERVER CONTROL - ASP.NET WITH C#priya Nithya
 
ASP.NET - Life cycle of asp
ASP.NET - Life cycle of aspASP.NET - Life cycle of asp
ASP.NET - Life cycle of asppriya Nithya
 
Web application using c# Lab - Web Configuration file
Web application using c# Lab - Web Configuration fileWeb application using c# Lab - Web Configuration file
Web application using c# Lab - Web Configuration filepriya Nithya
 
Creation of simple application using - step by step
Creation of simple application using - step by stepCreation of simple application using - step by step
Creation of simple application using - step by steppriya Nithya
 
Adaptation of tcp window
Adaptation of tcp windowAdaptation of tcp window
Adaptation of tcp windowpriya Nithya
 
Key mechanism of mobile ip
Key mechanism of mobile ip Key mechanism of mobile ip
Key mechanism of mobile ip priya Nithya
 
Mobile ip overview
Mobile ip overviewMobile ip overview
Mobile ip overviewpriya Nithya
 
Features of mobile ip
Features of mobile ipFeatures of mobile ip
Features of mobile ippriya Nithya
 
Creating a Name seperator Custom Control using C#
Creating a Name seperator Custom Control using C#Creating a Name seperator Custom Control using C#
Creating a Name seperator Custom Control using C#priya Nithya
 
How to Create Database component -Enterprise Application Using C# Lab
How to Create Database component -Enterprise Application Using C# Lab  How to Create Database component -Enterprise Application Using C# Lab
How to Create Database component -Enterprise Application Using C# Lab priya Nithya
 
Creating simple component
Creating simple componentCreating simple component
Creating simple componentpriya Nithya
 

Plus de priya Nithya (19)

Android Architecture.pptx
Android Architecture.pptxAndroid Architecture.pptx
Android Architecture.pptx
 
Html server control - ASP. NET with c#
Html server control - ASP. NET with c#Html server control - ASP. NET with c#
Html server control - ASP. NET with c#
 
Modes of transfer - Computer Organization & Architecture - Nithiyapriya Pasav...
Modes of transfer - Computer Organization & Architecture - Nithiyapriya Pasav...Modes of transfer - Computer Organization & Architecture - Nithiyapriya Pasav...
Modes of transfer - Computer Organization & Architecture - Nithiyapriya Pasav...
 
Asynchronous data transfer
Asynchronous data transferAsynchronous data transfer
Asynchronous data transfer
 
Asp.net state management
Asp.net state managementAsp.net state management
Asp.net state management
 
HTTP REQUEST RESPONSE OBJECT - WEB APPLICATION USING C# LAB
HTTP REQUEST RESPONSE OBJECT - WEB APPLICATION USING C# LABHTTP REQUEST RESPONSE OBJECT - WEB APPLICATION USING C# LAB
HTTP REQUEST RESPONSE OBJECT - WEB APPLICATION USING C# LAB
 
HTML SERVER CONTROL - ASP.NET WITH C#
HTML SERVER CONTROL  - ASP.NET WITH C#HTML SERVER CONTROL  - ASP.NET WITH C#
HTML SERVER CONTROL - ASP.NET WITH C#
 
ASP.NET - Life cycle of asp
ASP.NET - Life cycle of aspASP.NET - Life cycle of asp
ASP.NET - Life cycle of asp
 
Web application using c# Lab - Web Configuration file
Web application using c# Lab - Web Configuration fileWeb application using c# Lab - Web Configuration file
Web application using c# Lab - Web Configuration file
 
Creation of simple application using - step by step
Creation of simple application using - step by stepCreation of simple application using - step by step
Creation of simple application using - step by step
 
Adaptation of tcp window
Adaptation of tcp windowAdaptation of tcp window
Adaptation of tcp window
 
Asp.net Overview
Asp.net OverviewAsp.net Overview
Asp.net Overview
 
Key mechanism of mobile ip
Key mechanism of mobile ip Key mechanism of mobile ip
Key mechanism of mobile ip
 
Mobile ip overview
Mobile ip overviewMobile ip overview
Mobile ip overview
 
Features of mobile ip
Features of mobile ipFeatures of mobile ip
Features of mobile ip
 
Creating a Name seperator Custom Control using C#
Creating a Name seperator Custom Control using C#Creating a Name seperator Custom Control using C#
Creating a Name seperator Custom Control using C#
 
How to Create Database component -Enterprise Application Using C# Lab
How to Create Database component -Enterprise Application Using C# Lab  How to Create Database component -Enterprise Application Using C# Lab
How to Create Database component -Enterprise Application Using C# Lab
 
Creating simple component
Creating simple componentCreating simple component
Creating simple component
 
Internet (i mcom)
Internet (i mcom)Internet (i mcom)
Internet (i mcom)
 

Dernier

ARTICULAR DISC OF TEMPOROMANDIBULAR JOINT
ARTICULAR DISC OF TEMPOROMANDIBULAR JOINTARTICULAR DISC OF TEMPOROMANDIBULAR JOINT
ARTICULAR DISC OF TEMPOROMANDIBULAR JOINTDR. SNEHA NAIR
 
Riddhi Kevadiya. WILLIAM SHAKESPEARE....
Riddhi Kevadiya. WILLIAM SHAKESPEARE....Riddhi Kevadiya. WILLIAM SHAKESPEARE....
Riddhi Kevadiya. WILLIAM SHAKESPEARE....Riddhi Kevadiya
 
Patient Counselling. Definition of patient counseling; steps involved in pati...
Patient Counselling. Definition of patient counseling; steps involved in pati...Patient Counselling. Definition of patient counseling; steps involved in pati...
Patient Counselling. Definition of patient counseling; steps involved in pati...raviapr7
 
Protein Structure - threading Protein modelling pptx
Protein Structure - threading Protein modelling pptxProtein Structure - threading Protein modelling pptx
Protein Structure - threading Protein modelling pptxvidhisharma994099
 
3.21.24 The Origins of Black Power.pptx
3.21.24  The Origins of Black Power.pptx3.21.24  The Origins of Black Power.pptx
3.21.24 The Origins of Black Power.pptxmary850239
 
10 Topics For MBA Project Report [HR].pdf
10 Topics For MBA Project Report [HR].pdf10 Topics For MBA Project Report [HR].pdf
10 Topics For MBA Project Report [HR].pdfJayanti Pande
 
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptx
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptxSOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptx
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptxSyedNadeemGillANi
 
KARNAADA.pptx made by - saransh dwivedi ( SD ) - SHALAKYA TANTRA - ENT - 4...
KARNAADA.pptx  made by -  saransh dwivedi ( SD ) -  SHALAKYA TANTRA - ENT - 4...KARNAADA.pptx  made by -  saransh dwivedi ( SD ) -  SHALAKYA TANTRA - ENT - 4...
KARNAADA.pptx made by - saransh dwivedi ( SD ) - SHALAKYA TANTRA - ENT - 4...M56BOOKSTORE PRODUCT/SERVICE
 
5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...CaraSkikne1
 
Education and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxEducation and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxraviapr7
 
Vani Magazine - Quarterly Magazine of Seshadripuram Educational Trust
Vani Magazine - Quarterly Magazine of Seshadripuram Educational TrustVani Magazine - Quarterly Magazine of Seshadripuram Educational Trust
Vani Magazine - Quarterly Magazine of Seshadripuram Educational TrustSavipriya Raghavendra
 
How to Send Emails From Odoo 17 Using Code
How to Send Emails From Odoo 17 Using CodeHow to Send Emails From Odoo 17 Using Code
How to Send Emails From Odoo 17 Using CodeCeline George
 
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...Nguyen Thanh Tu Collection
 
Drug Information Services- DIC and Sources.
Drug Information Services- DIC and Sources.Drug Information Services- DIC and Sources.
Drug Information Services- DIC and Sources.raviapr7
 
Over the counter (OTC)- Sale, rational use.pptx
Over the counter (OTC)- Sale, rational use.pptxOver the counter (OTC)- Sale, rational use.pptx
Over the counter (OTC)- Sale, rational use.pptxraviapr7
 
HED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfHED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfMohonDas
 
EBUS5423 Data Analytics and Reporting Bl
EBUS5423 Data Analytics and Reporting BlEBUS5423 Data Analytics and Reporting Bl
EBUS5423 Data Analytics and Reporting BlDr. Bruce A. Johnson
 
How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17Celine George
 
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRADUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRATanmoy Mishra
 

Dernier (20)

ARTICULAR DISC OF TEMPOROMANDIBULAR JOINT
ARTICULAR DISC OF TEMPOROMANDIBULAR JOINTARTICULAR DISC OF TEMPOROMANDIBULAR JOINT
ARTICULAR DISC OF TEMPOROMANDIBULAR JOINT
 
Riddhi Kevadiya. WILLIAM SHAKESPEARE....
Riddhi Kevadiya. WILLIAM SHAKESPEARE....Riddhi Kevadiya. WILLIAM SHAKESPEARE....
Riddhi Kevadiya. WILLIAM SHAKESPEARE....
 
Patient Counselling. Definition of patient counseling; steps involved in pati...
Patient Counselling. Definition of patient counseling; steps involved in pati...Patient Counselling. Definition of patient counseling; steps involved in pati...
Patient Counselling. Definition of patient counseling; steps involved in pati...
 
Protein Structure - threading Protein modelling pptx
Protein Structure - threading Protein modelling pptxProtein Structure - threading Protein modelling pptx
Protein Structure - threading Protein modelling pptx
 
3.21.24 The Origins of Black Power.pptx
3.21.24  The Origins of Black Power.pptx3.21.24  The Origins of Black Power.pptx
3.21.24 The Origins of Black Power.pptx
 
10 Topics For MBA Project Report [HR].pdf
10 Topics For MBA Project Report [HR].pdf10 Topics For MBA Project Report [HR].pdf
10 Topics For MBA Project Report [HR].pdf
 
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptx
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptxSOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptx
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptx
 
KARNAADA.pptx made by - saransh dwivedi ( SD ) - SHALAKYA TANTRA - ENT - 4...
KARNAADA.pptx  made by -  saransh dwivedi ( SD ) -  SHALAKYA TANTRA - ENT - 4...KARNAADA.pptx  made by -  saransh dwivedi ( SD ) -  SHALAKYA TANTRA - ENT - 4...
KARNAADA.pptx made by - saransh dwivedi ( SD ) - SHALAKYA TANTRA - ENT - 4...
 
5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...
 
March 2024 Directors Meeting, Division of Student Affairs and Academic Support
March 2024 Directors Meeting, Division of Student Affairs and Academic SupportMarch 2024 Directors Meeting, Division of Student Affairs and Academic Support
March 2024 Directors Meeting, Division of Student Affairs and Academic Support
 
Education and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxEducation and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptx
 
Vani Magazine - Quarterly Magazine of Seshadripuram Educational Trust
Vani Magazine - Quarterly Magazine of Seshadripuram Educational TrustVani Magazine - Quarterly Magazine of Seshadripuram Educational Trust
Vani Magazine - Quarterly Magazine of Seshadripuram Educational Trust
 
How to Send Emails From Odoo 17 Using Code
How to Send Emails From Odoo 17 Using CodeHow to Send Emails From Odoo 17 Using Code
How to Send Emails From Odoo 17 Using Code
 
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
 
Drug Information Services- DIC and Sources.
Drug Information Services- DIC and Sources.Drug Information Services- DIC and Sources.
Drug Information Services- DIC and Sources.
 
Over the counter (OTC)- Sale, rational use.pptx
Over the counter (OTC)- Sale, rational use.pptxOver the counter (OTC)- Sale, rational use.pptx
Over the counter (OTC)- Sale, rational use.pptx
 
HED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfHED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdf
 
EBUS5423 Data Analytics and Reporting Bl
EBUS5423 Data Analytics and Reporting BlEBUS5423 Data Analytics and Reporting Bl
EBUS5423 Data Analytics and Reporting Bl
 
How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17
 
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRADUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
 

Android LAb - Creating an android app with Radio button

  • 1. Android App with Radio button group – NITHIYAPRIYA PASAVARAJ Android Application with Radio Button Activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".MainActivity" > <LinearLayout android:id="@+id/lnrlayout" android:layout_width="fill_parent" android:layout_height="756dp" android:orientation="vertical"> <TextView android:id="@+id/textView2"
  • 2. Android App with Radio button group – NITHIYAPRIYA PASAVARAJ android:layout_width="wrap_content" android:layout_height="72dp" android:text="Select Your Favorite Color" android:textColor="#7B1FA2" android:textSize="30sp" android:textStyle="bold" tools:layout_conversion_absoluteHeight="61dp" tools:layout_conversion_absoluteWidth="388dp" tools:layout_editor_absoluteX="0dp" tools:layout_editor_absoluteY="0dp" /> <RadioGroup android:layout_width="355dp" android:layout_height="397dp"> <RadioButton android:id="@+id/clrred" android:layout_width="match_parent" android:layout_height="47dp" android:layout_weight="1" android:checked="false" android:text="Red" android:textAllCaps="true" android:textColor="#E64A19" android:textSize="24sp" android:textStyle="bold|italic" /> <RadioButton android:id="@+id/clrblue" android:layout_width="match_parent" android:layout_height="43dp" android:layout_weight="1" android:checked="false" android:text="Blue" android:textAllCaps="true" android:textColor="#512DA8" android:textSize="24sp" android:textStyle="bold|italic" /> <RadioButton android:id="@+id/clrgreen" android:layout_width="match_parent" android:layout_height="wrap_content"
  • 3. Android App with Radio button group – NITHIYAPRIYA PASAVARAJ android:layout_weight="1" android:text="Green" android:textAllCaps="true" android:textColor="#00796B" android:textSize="24sp" android:textStyle="bold|italic" /> <RadioButton android:id="@+id/clryellow" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="Yellow" android:textAllCaps="true" android:textColor="#FBC02D" android:textSize="24sp" android:textStyle="bold|italic" /> <RadioButton android:id="@+id/clrorange" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="Gray" android:textAllCaps="true" android:textColor="#A3A39F" android:textSize="24sp" android:textStyle="bold|italic" /> </RadioGroup> <Button android:id="@+id/btnsubmit" android:layout_width="180dp" android:layout_height="60dp" android:layout_gravity="center" android:background="#9DC218" android:text="Submit" android:textAllCaps="true" android:textColor="#7B1FA2" android:textSize="30sp" android:textStyle="bold" />
  • 4. Android App with Radio button group – NITHIYAPRIYA PASAVARAJ <TextView android:id="@+id/txtview" android:layout_width="match_parent" android:layout_height="132dp" android:textSize="30sp" android:textStyle="bold" /> </LinearLayout> </LinearLayout> Mainactivity.java package com.example.radiobtngrp; import androidx.appcompat.app.AppCompatActivity; import android.graphics.Color; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; import android.widget.RadioButton; import android.widget.TextView; public class MainActivity extends AppCompatActivity { RadioButton red,blue,green,yellow,orange; Button btnsubmit; TextView txtview; LinearLayout lnrlayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); red=(RadioButton )findViewById(R.id.clrred); blue = (RadioButton)findViewById(R.id.clrblue); green = (RadioButton)findViewById(R.id.clrgreen); orange = (RadioButton)findViewById(R.id.clrorange); yellow = (RadioButton)findViewById(R.id.clryellow); btnsubmit = (Button)findViewById(R.id.btnsubmit); txtview = (TextView)findViewById(R.id.txtview) ; lnrlayout = (LinearLayout) findViewById(R.id.lnrlayout); btnsubmit.setOnClickListener(new View.OnClickListener() { @Override
  • 5. Android App with Radio button group – NITHIYAPRIYA PASAVARAJ public void onClick(View view) { if(red.isChecked()) { txtview.setText("You've Selected Red"); lnrlayout.setBackgroundColor(Color.RED); } if(blue.isChecked()) { txtview.setText("You've Selected Blue"); lnrlayout.setBackgroundColor(Color.BLUE); } if(green.isChecked()) { txtview.setText("You've Selected Green"); lnrlayout.setBackgroundColor(Color.GREEN); } if(yellow.isChecked()) { txtview.setText("You've Selected Yellow"); lnrlayout.setBackgroundColor(Color.YELLOW); } if(orange.isChecked()) { txtview.setText("You've Selected Gray"); lnrlayout.setBackgroundColor(Color.DKGRAY); //lnrlayout.setBackgroundColor(-565); } } }); } }