SlideShare uma empresa Scribd logo
1 de 13
Android.Widgets
        Tutorial 1 : Empowering Android Widgets




By: Mr.PrajyotMainkar
MS Software Systems( BITS-Pilani)
BE(Hons.) Computer Engineering , PMP( IIT Delhi)
                                                   S
TextView – The Andro-Label

     The simplest widget is the label, referred to in Android as a TextView .
              Typically, these are used like labels in Android UI

Create a new android project with following contents in main.xml and run this project
                                    on emulator


                  <?xml version="1.0" encoding="utf-8"?>
    <TextViewxmlns:android="http://schemas.android.com/apk/res/android"
                     android:layout_width="fill_parent"
                   android:layout_height="wrap_content"
              android:text="This is sample demo of TextView"
                                     />
TextView – The Andro-Label

The following output is obtained when you run the code via emulator.
Images – Fleeting with images

Android has two widgets to help embed images in your activities: ImageViewand
                                ImageButton.
  As the names suggest, they are image-based analogues to TextView and
                             Button , respectively.

                 <?xml version="1.0" encoding="utf-8"?>
   <ImageViewxmlns:android="http://schemas.android.com/apk/res/android"
                         android:id="@+id/icon"
                    android:layout_width="fill_parent"
                   android:layout_height="fill_parent"
                    android:adjustViewBounds="true"
                     android:src="@drawable/logo"
                                    />
    Note that, android:src takes path of image from the drawable folder(@ is the
     reference), so drag „n drop /paste any logo.png image to drawable folder.
Images – Fleeting with images

 The following output is obtained when you run the code via emulator.
EditText– Learning EditText

EditText is a thin veneer over TextView that configures itself to be editable. In the java
file (Src folder) import the file “import android.widget.EditText;”. Find the xml code
                                           below


                     <?xml version="1.0" encoding="utf-8"?>
       <EditTextxmlns:android="http://schemas.android.com/apk/res/android"
                           android:id="@+id/editfield"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                            android:singleLine="false"
                                         />
EditText – Learning EditText

package com.EditTextDemo;

import android.app.Activity;
import android.os.Bundle;
import android.widget.EditText;

public class EditTextDemoActivity extends Activity {
  /** Called when the activity is first created. */
@Override
EditText E;
  public void onCreate(BundlesavedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
E.setText("This is sample edit text demo");
  }
}
CheckBox– Lets *Check*

•isChecked(): Determines if the check box has been checked.
•setChecked(): Forces the check box into a checked or unchecked
•state.
•toggle(): Toggles the check box as if the user checked it.



                   <?xml version="1.0" encoding="utf-8"?>
      <CheckBoxxmlns:android="http://schemas.android.com/apk/res/android"
                         android:id="@+id/checkbox"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                android:text="This checkbox is unchecked" />
CheckBox – Lets *Check*
package com.CheckBoxDemo;

import android.app.Activity;
import android.os.Bundle;
import android.widget.CheckBox;
import android.widget.CompoundButton;

public class CheckBoxDemoActivity extends Activity implements CompoundButton.OnCheckedChangeListener {
CheckBox checkbox;
public void onCreate(BundlesavedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
      checkbox=(CheckBox)findViewById(R.id.checkbox);
checkbox.setOnCheckedChangeListener(this);
      }
public void onCheckedChanged(CompoundButtonbuttonView,
booleanisChecked) {
if (isChecked) {
checkbox.setText("This checkbox is: checked");
}
else     {
checkbox.setText("This checkbox is: unchecked");
          }
      }
      }
CheckBox – Lets *Check*

The following output is obtained when you run the code via emulator.
RadioButton – Tune Up

                 •check(): Checks a specific radio button via its ID
      •clearCheck(): Clears all radio buttons, so none in the group are checked.
•getCheckedRadioButtonId(): Gets the ID of the currently checked radio button (or -1 if
                                  none are checked).

       Most times RadioButton widgets are placed inside a RadioGroup . The
 RadioGroup indicates a set of radio buttons whose state is tied, meaning only one
                                      button
   in that group can be selected at any time. If you assign an android:id to your
RadioGroup in your XML layout, you can access the group from your Java code and
RadioButton – Tune Up

•The XML Code is below. Make no changes to Java File :
        <?xml version="1.0" encoding="utf-8"?>
        <RadioGroup
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >
        <RadioButton android:id="@+id/radio1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Goa" />
        <RadioButton android:id="@+id/radio2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Maharashtra" />
        <RadioButton android:id="@+id/radio3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Kerala" />
        </RadioGroup>
Thank you..
GET IN TOUCH– Tune Up
   RadioButton
                               Phone:
                               +91-9822987513
 facebook.com/prajyotmainkar

                               Email:
 twitter.com/prajyotm          prajyotm@msn.com

Mais conteúdo relacionado

Mais procurados

Londroid Android Home Screen Widgets
Londroid Android Home Screen WidgetsLondroid Android Home Screen Widgets
Londroid Android Home Screen WidgetsRichard Hyndman
 
Marakana Android User Interface
Marakana Android User InterfaceMarakana Android User Interface
Marakana Android User InterfaceMarko Gargenta
 
Day 15: Working in Background
Day 15: Working in BackgroundDay 15: Working in Background
Day 15: Working in BackgroundAhsanul Karim
 
Android Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAndroid Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAhsanul Karim
 
Android ui layout
Android ui layoutAndroid ui layout
Android ui layoutKrazy Koder
 
Create an android app for database creation using.pptx
Create an android app for database creation using.pptxCreate an android app for database creation using.pptx
Create an android app for database creation using.pptxvishal choudhary
 
View groups containers
View groups containersView groups containers
View groups containersMani Selvaraj
 
Day: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentDay: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentAhsanul Karim
 
Day 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through ActivitiesDay 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through ActivitiesAhsanul Karim
 
Lecture 3 getting active through activities
Lecture 3 getting active through activities Lecture 3 getting active through activities
Lecture 3 getting active through activities Ahsanul Karim
 
Day 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIDay 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIAhsanul Karim
 
Develop a native application that uses GPS location.pptx
Develop a native application that uses GPS location.pptxDevelop a native application that uses GPS location.pptx
Develop a native application that uses GPS location.pptxvishal choudhary
 
Android Tutorial
Android TutorialAndroid Tutorial
Android TutorialFun2Do Labs
 

Mais procurados (20)

Londroid Android Home Screen Widgets
Londroid Android Home Screen WidgetsLondroid Android Home Screen Widgets
Londroid Android Home Screen Widgets
 
Android UI
Android UIAndroid UI
Android UI
 
Marakana Android User Interface
Marakana Android User InterfaceMarakana Android User Interface
Marakana Android User Interface
 
Day 15: Working in Background
Day 15: Working in BackgroundDay 15: Working in Background
Day 15: Working in Background
 
Android Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAndroid Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver Tutorial
 
Android ui layout
Android ui layoutAndroid ui layout
Android ui layout
 
Create an android app for database creation using.pptx
Create an android app for database creation using.pptxCreate an android app for database creation using.pptx
Create an android app for database creation using.pptx
 
View groups containers
View groups containersView groups containers
View groups containers
 
List Views
List ViewsList Views
List Views
 
Day: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application DevelopmentDay: 2 Environment Setup for Android Application Development
Day: 2 Environment Setup for Android Application Development
 
Day 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through ActivitiesDay 4: Android: Getting Active through Activities
Day 4: Android: Getting Active through Activities
 
Lecture 3 getting active through activities
Lecture 3 getting active through activities Lecture 3 getting active through activities
Lecture 3 getting active through activities
 
Android Basic Components
Android Basic ComponentsAndroid Basic Components
Android Basic Components
 
Day 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIDay 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts API
 
Android xml-based layouts-chapter5
Android xml-based layouts-chapter5Android xml-based layouts-chapter5
Android xml-based layouts-chapter5
 
Android UI Fundamentals part 1
Android UI Fundamentals part 1Android UI Fundamentals part 1
Android UI Fundamentals part 1
 
Android session 3
Android session 3Android session 3
Android session 3
 
Android session 2
Android session 2Android session 2
Android session 2
 
Develop a native application that uses GPS location.pptx
Develop a native application that uses GPS location.pptxDevelop a native application that uses GPS location.pptx
Develop a native application that uses GPS location.pptx
 
Android Tutorial
Android TutorialAndroid Tutorial
Android Tutorial
 

Destaque

Lecture Slides for List Views [Android ]
Lecture Slides for List Views [Android ]Lecture Slides for List Views [Android ]
Lecture Slides for List Views [Android ]Nehil Jain
 
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & SpinnerAndroid User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & SpinnerAhsanul Karim
 
Android Workshop Day 1 Part 2
Android Workshop Day 1 Part 2Android Workshop Day 1 Part 2
Android Workshop Day 1 Part 2Ahsanul Karim
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesAhsanul Karim
 
Android Training (AdapterView & Adapter)
Android Training (AdapterView & Adapter)Android Training (AdapterView & Adapter)
Android Training (AdapterView & Adapter)Khaled Anaqwa
 
Android development - ListView & Adapter
Android development - ListView & AdapterAndroid development - ListView & Adapter
Android development - ListView & AdapterLope Emano
 
Events and Listeners in Android
Events and Listeners in AndroidEvents and Listeners in Android
Events and Listeners in Androidma-polimi
 
Intent in android
Intent in androidIntent in android
Intent in androidDurai S
 
Basic android-ppt
Basic android-pptBasic android-ppt
Basic android-pptSrijib Roy
 
Screen orientations in android
Screen orientations in androidScreen orientations in android
Screen orientations in androidmanjakannar
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesAhsanul Karim
 
Day 9: Make Your App Location Aware using Location API
Day 9: Make Your App Location Aware using Location APIDay 9: Make Your App Location Aware using Location API
Day 9: Make Your App Location Aware using Location APIAhsanul Karim
 
ListView and Custom ListView on Android Development [Thai]
ListView and Custom ListView on Android Development [Thai]ListView and Custom ListView on Android Development [Thai]
ListView and Custom ListView on Android Development [Thai]Somkiat Khitwongwattana
 
Android: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast ReceiversAndroid: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast ReceiversCodeAndroid
 
Android GPS Tutorial
Android GPS TutorialAndroid GPS Tutorial
Android GPS TutorialAhsanul Karim
 
Ateliers : Developpement mobile vs open source
Ateliers : Developpement mobile vs open sourceAteliers : Developpement mobile vs open source
Ateliers : Developpement mobile vs open sourceKorteby Farouk
 
Android tutorial ppt
Android tutorial pptAndroid tutorial ppt
Android tutorial pptRehna Renu
 
Day 3 of C++ Boot Camp - C++11 Language Deep Dive
Day 3 of C++ Boot Camp - C++11 Language Deep DiveDay 3 of C++ Boot Camp - C++11 Language Deep Dive
Day 3 of C++ Boot Camp - C++11 Language Deep DiveJim McKeeth
 

Destaque (20)

Android adapters
Android adaptersAndroid adapters
Android adapters
 
Lecture Slides for List Views [Android ]
Lecture Slides for List Views [Android ]Lecture Slides for List Views [Android ]
Lecture Slides for List Views [Android ]
 
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & SpinnerAndroid User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
 
Java pour android
Java pour androidJava pour android
Java pour android
 
Android Workshop Day 1 Part 2
Android Workshop Day 1 Part 2Android Workshop Day 1 Part 2
Android Workshop Day 1 Part 2
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
 
Android Training (AdapterView & Adapter)
Android Training (AdapterView & Adapter)Android Training (AdapterView & Adapter)
Android Training (AdapterView & Adapter)
 
Android development - ListView & Adapter
Android development - ListView & AdapterAndroid development - ListView & Adapter
Android development - ListView & Adapter
 
Events and Listeners in Android
Events and Listeners in AndroidEvents and Listeners in Android
Events and Listeners in Android
 
Intent in android
Intent in androidIntent in android
Intent in android
 
Basic android-ppt
Basic android-pptBasic android-ppt
Basic android-ppt
 
Screen orientations in android
Screen orientations in androidScreen orientations in android
Screen orientations in android
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
 
Day 9: Make Your App Location Aware using Location API
Day 9: Make Your App Location Aware using Location APIDay 9: Make Your App Location Aware using Location API
Day 9: Make Your App Location Aware using Location API
 
ListView and Custom ListView on Android Development [Thai]
ListView and Custom ListView on Android Development [Thai]ListView and Custom ListView on Android Development [Thai]
ListView and Custom ListView on Android Development [Thai]
 
Android: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast ReceiversAndroid: Intent, Intent Filter, Broadcast Receivers
Android: Intent, Intent Filter, Broadcast Receivers
 
Android GPS Tutorial
Android GPS TutorialAndroid GPS Tutorial
Android GPS Tutorial
 
Ateliers : Developpement mobile vs open source
Ateliers : Developpement mobile vs open sourceAteliers : Developpement mobile vs open source
Ateliers : Developpement mobile vs open source
 
Android tutorial ppt
Android tutorial pptAndroid tutorial ppt
Android tutorial ppt
 
Day 3 of C++ Boot Camp - C++11 Language Deep Dive
Day 3 of C++ Boot Camp - C++11 Language Deep DiveDay 3 of C++ Boot Camp - C++11 Language Deep Dive
Day 3 of C++ Boot Camp - C++11 Language Deep Dive
 

Semelhante a Android Tutorials : Basic widgets

Android Development Made Easy - With Sample Project
Android Development Made Easy - With Sample ProjectAndroid Development Made Easy - With Sample Project
Android Development Made Easy - With Sample ProjectJoemarie Amparo
 
01 09 - graphical user interface - basic widgets
01  09 - graphical user interface - basic widgets01  09 - graphical user interface - basic widgets
01 09 - graphical user interface - basic widgetsSiva Kumar reddy Vasipally
 
Android Development for Beginners with Sample Project - Day 1
Android Development for Beginners with Sample Project - Day 1Android Development for Beginners with Sample Project - Day 1
Android Development for Beginners with Sample Project - Day 1Joemarie Amparo
 
android level 3
android level 3android level 3
android level 3DevMix
 
Android Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidAndroid Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidDenis Minja
 
Android Workshop
Android WorkshopAndroid Workshop
Android WorkshopJunda Ong
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorialAbid Khan
 
android training_material ravy ramio
android training_material ravy ramioandroid training_material ravy ramio
android training_material ravy ramioslesulvy
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android AppsGil Irizarry
 
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
 
Lec005 android start_program
Lec005 android start_programLec005 android start_program
Lec005 android start_programEyad Almasri
 
06. Android Basic Widget and Container
06. Android Basic Widget and Container06. Android Basic Widget and Container
06. Android Basic Widget and ContainerOum Saokosal
 
Introduction To Google Android (Ft Rohan Bomle)
Introduction To Google Android (Ft Rohan Bomle)Introduction To Google Android (Ft Rohan Bomle)
Introduction To Google Android (Ft Rohan Bomle)Fafadia Tech
 
Synapseindia android apps introduction hello world
Synapseindia android apps introduction hello worldSynapseindia android apps introduction hello world
Synapseindia android apps introduction hello worldTarunsingh198
 
21 android2 updated
21 android2 updated21 android2 updated
21 android2 updatedGhanaGTUG
 
Leture5 exercise onactivities
Leture5 exercise onactivitiesLeture5 exercise onactivities
Leture5 exercise onactivitiesmaamir farooq
 

Semelhante a Android Tutorials : Basic widgets (20)

Android Development Made Easy - With Sample Project
Android Development Made Easy - With Sample ProjectAndroid Development Made Easy - With Sample Project
Android Development Made Easy - With Sample Project
 
01 09 - graphical user interface - basic widgets
01  09 - graphical user interface - basic widgets01  09 - graphical user interface - basic widgets
01 09 - graphical user interface - basic widgets
 
Android Development for Beginners with Sample Project - Day 1
Android Development for Beginners with Sample Project - Day 1Android Development for Beginners with Sample Project - Day 1
Android Development for Beginners with Sample Project - Day 1
 
android level 3
android level 3android level 3
android level 3
 
Android Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidAndroid Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_android
 
Android
AndroidAndroid
Android
 
Android Workshop
Android WorkshopAndroid Workshop
Android Workshop
 
Android Button
Android ButtonAndroid Button
Android Button
 
Ap quiz app
Ap quiz appAp quiz app
Ap quiz app
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
android training_material ravy ramio
android training_material ravy ramioandroid training_material ravy ramio
android training_material ravy ramio
 
Beginning Native Android Apps
Beginning Native Android AppsBeginning Native Android Apps
Beginning Native Android Apps
 
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
 
Lec005 android start_program
Lec005 android start_programLec005 android start_program
Lec005 android start_program
 
1. shared pref
1. shared pref1. shared pref
1. shared pref
 
06. Android Basic Widget and Container
06. Android Basic Widget and Container06. Android Basic Widget and Container
06. Android Basic Widget and Container
 
Introduction To Google Android (Ft Rohan Bomle)
Introduction To Google Android (Ft Rohan Bomle)Introduction To Google Android (Ft Rohan Bomle)
Introduction To Google Android (Ft Rohan Bomle)
 
Synapseindia android apps introduction hello world
Synapseindia android apps introduction hello worldSynapseindia android apps introduction hello world
Synapseindia android apps introduction hello world
 
21 android2 updated
21 android2 updated21 android2 updated
21 android2 updated
 
Leture5 exercise onactivities
Leture5 exercise onactivitiesLeture5 exercise onactivities
Leture5 exercise onactivities
 

Mais de Prajyot Mainkar

Kolkata kreate - Talk by Prajyot Mainkar
Kolkata kreate - Talk by Prajyot MainkarKolkata kreate - Talk by Prajyot Mainkar
Kolkata kreate - Talk by Prajyot MainkarPrajyot Mainkar
 
Devfest baroda 2019 By prajyot mainkar
Devfest baroda 2019 By prajyot mainkarDevfest baroda 2019 By prajyot mainkar
Devfest baroda 2019 By prajyot mainkarPrajyot Mainkar
 
Android Power Optimization: May the Power be with you
Android Power Optimization: May the Power be with youAndroid Power Optimization: May the Power be with you
Android Power Optimization: May the Power be with youPrajyot Mainkar
 
Gaining the app visibility that matters
Gaining the app visibility that mattersGaining the app visibility that matters
Gaining the app visibility that mattersPrajyot Mainkar
 
Nitrodroid 2013 - Closing Report
Nitrodroid 2013 - Closing ReportNitrodroid 2013 - Closing Report
Nitrodroid 2013 - Closing ReportPrajyot Mainkar
 
Building Hybrid Applications using PhoneGap
Building Hybrid Applications using PhoneGapBuilding Hybrid Applications using PhoneGap
Building Hybrid Applications using PhoneGapPrajyot Mainkar
 
Android Cloud to Device Messaging Framework
Android Cloud to Device Messaging FrameworkAndroid Cloud to Device Messaging Framework
Android Cloud to Device Messaging FrameworkPrajyot Mainkar
 
Evolution google-android play
Evolution google-android playEvolution google-android play
Evolution google-android playPrajyot Mainkar
 
Steps to install android
Steps to install androidSteps to install android
Steps to install androidPrajyot Mainkar
 

Mais de Prajyot Mainkar (14)

Kolkata kreate - Talk by Prajyot Mainkar
Kolkata kreate - Talk by Prajyot MainkarKolkata kreate - Talk by Prajyot Mainkar
Kolkata kreate - Talk by Prajyot Mainkar
 
Devfest baroda 2019 By prajyot mainkar
Devfest baroda 2019 By prajyot mainkarDevfest baroda 2019 By prajyot mainkar
Devfest baroda 2019 By prajyot mainkar
 
Building for next india
Building for next indiaBuilding for next india
Building for next india
 
Pitch that matters
Pitch that mattersPitch that matters
Pitch that matters
 
Android Power Optimization: May the Power be with you
Android Power Optimization: May the Power be with youAndroid Power Optimization: May the Power be with you
Android Power Optimization: May the Power be with you
 
Android performance
Android performanceAndroid performance
Android performance
 
Gaining the app visibility that matters
Gaining the app visibility that mattersGaining the app visibility that matters
Gaining the app visibility that matters
 
DroidSync 2014
DroidSync 2014DroidSync 2014
DroidSync 2014
 
Nitrodroid 2013 - Closing Report
Nitrodroid 2013 - Closing ReportNitrodroid 2013 - Closing Report
Nitrodroid 2013 - Closing Report
 
Google Cloud Messaging
Google Cloud Messaging Google Cloud Messaging
Google Cloud Messaging
 
Building Hybrid Applications using PhoneGap
Building Hybrid Applications using PhoneGapBuilding Hybrid Applications using PhoneGap
Building Hybrid Applications using PhoneGap
 
Android Cloud to Device Messaging Framework
Android Cloud to Device Messaging FrameworkAndroid Cloud to Device Messaging Framework
Android Cloud to Device Messaging Framework
 
Evolution google-android play
Evolution google-android playEvolution google-android play
Evolution google-android play
 
Steps to install android
Steps to install androidSteps to install android
Steps to install android
 

Último

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 

Último (20)

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 

Android Tutorials : Basic widgets

  • 1. Android.Widgets Tutorial 1 : Empowering Android Widgets By: Mr.PrajyotMainkar MS Software Systems( BITS-Pilani) BE(Hons.) Computer Engineering , PMP( IIT Delhi) S
  • 2. TextView – The Andro-Label The simplest widget is the label, referred to in Android as a TextView . Typically, these are used like labels in Android UI Create a new android project with following contents in main.xml and run this project on emulator <?xml version="1.0" encoding="utf-8"?> <TextViewxmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="This is sample demo of TextView" />
  • 3. TextView – The Andro-Label The following output is obtained when you run the code via emulator.
  • 4. Images – Fleeting with images Android has two widgets to help embed images in your activities: ImageViewand ImageButton. As the names suggest, they are image-based analogues to TextView and Button , respectively. <?xml version="1.0" encoding="utf-8"?> <ImageViewxmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/icon" android:layout_width="fill_parent" android:layout_height="fill_parent" android:adjustViewBounds="true" android:src="@drawable/logo" /> Note that, android:src takes path of image from the drawable folder(@ is the reference), so drag „n drop /paste any logo.png image to drawable folder.
  • 5. Images – Fleeting with images The following output is obtained when you run the code via emulator.
  • 6. EditText– Learning EditText EditText is a thin veneer over TextView that configures itself to be editable. In the java file (Src folder) import the file “import android.widget.EditText;”. Find the xml code below <?xml version="1.0" encoding="utf-8"?> <EditTextxmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/editfield" android:layout_width="fill_parent" android:layout_height="fill_parent" android:singleLine="false" />
  • 7. EditText – Learning EditText package com.EditTextDemo; import android.app.Activity; import android.os.Bundle; import android.widget.EditText; public class EditTextDemoActivity extends Activity { /** Called when the activity is first created. */ @Override EditText E; public void onCreate(BundlesavedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); E.setText("This is sample edit text demo"); } }
  • 8. CheckBox– Lets *Check* •isChecked(): Determines if the check box has been checked. •setChecked(): Forces the check box into a checked or unchecked •state. •toggle(): Toggles the check box as if the user checked it. <?xml version="1.0" encoding="utf-8"?> <CheckBoxxmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="This checkbox is unchecked" />
  • 9. CheckBox – Lets *Check* package com.CheckBoxDemo; import android.app.Activity; import android.os.Bundle; import android.widget.CheckBox; import android.widget.CompoundButton; public class CheckBoxDemoActivity extends Activity implements CompoundButton.OnCheckedChangeListener { CheckBox checkbox; public void onCreate(BundlesavedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); checkbox=(CheckBox)findViewById(R.id.checkbox); checkbox.setOnCheckedChangeListener(this); } public void onCheckedChanged(CompoundButtonbuttonView, booleanisChecked) { if (isChecked) { checkbox.setText("This checkbox is: checked"); } else { checkbox.setText("This checkbox is: unchecked"); } } }
  • 10. CheckBox – Lets *Check* The following output is obtained when you run the code via emulator.
  • 11. RadioButton – Tune Up •check(): Checks a specific radio button via its ID •clearCheck(): Clears all radio buttons, so none in the group are checked. •getCheckedRadioButtonId(): Gets the ID of the currently checked radio button (or -1 if none are checked). Most times RadioButton widgets are placed inside a RadioGroup . The RadioGroup indicates a set of radio buttons whose state is tied, meaning only one button in that group can be selected at any time. If you assign an android:id to your RadioGroup in your XML layout, you can access the group from your Java code and
  • 12. RadioButton – Tune Up •The XML Code is below. Make no changes to Java File : <?xml version="1.0" encoding="utf-8"?> <RadioGroup xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <RadioButton android:id="@+id/radio1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Goa" /> <RadioButton android:id="@+id/radio2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Maharashtra" /> <RadioButton android:id="@+id/radio3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Kerala" /> </RadioGroup>
  • 13. Thank you.. GET IN TOUCH– Tune Up RadioButton Phone: +91-9822987513 facebook.com/prajyotmainkar Email: twitter.com/prajyotm prajyotm@msn.com