SlideShare une entreprise Scribd logo
1  sur  16
ANDROID
WIDGET
Topics
 What is an App Widget?
App Widget framework
Steps for creating an App Widget
Creating App Widget
configuration Activity
What is App Widget?
Widgets are an essential aspect of home screen
customization. You can imagine them as "at-a-glance"
views of an app's most important data and
functionality that is accessible right from the user's
home screen.
Usage Examples of App Widgets
• People can drop widgets onto their home
screen and interact.
• Widgets can provide a quick glimpse into fully
featured apps, such as showing upcoming
calendar events, or viewing details about a
song playing in the background.
• Users can also interact with your app through
the widget, for example pausing or switching
music tracks.
AppWidget Framework
• AppWidgetProviderInfo object
> Describes the metadata for an App Widget, such as
the App Widget's layout, update frequency, and the
AppWidgetProvider class.
> This should be defined in XML.
AppWidget Framework
• AppWidgetProvider class
> Defines the basic methods that allow you to
programmatically interface with the App Widget,
based on broadcast events. (AppWidgetProvider
class is a child class of BroadcastReceiver class.)
> Through it, you will receive broadcasts when the App
Widget is updated, enabled, disabled and deleted.
AppWidget Framework(cont..)
• View layout
> Defines the initial layout for the App
Widget, defined in XML.
• Additionally, you can implement an App Widget
configuration Activity.
Steps for Building an App Widget
Declare an AppWidgetProvider in the Manifest
file
Create the AppWidgetProviderInfo Metadata
XML file
Create the App Widget Layout XML file
Write the AppWidgetProvider Class
Declare AppWidgetProvider in
Manifest
• The <receiver> element requires the android:name
attribute, which specifies the AppWidgetProvider
• The <intent-filter> element must include an <action>
element with the android:name attribute. This attribute
specifies that the AppWidgetProvider accepts the
ACTION_APPWIDGET_UPDATE broadcast.
• The <meta-data> element specifies the location
Create AppWidgetProviderInfo Metadata
• Define the AppWidgetProviderInfo object in an XML
resource using a single <appwidget-provider> element
and save it in the project's res/xml/ folder.
> This file is referenced from the manifest file
• Defines the essential qualities of an App Widget, such
as its minimum layout dimensions, its initial layout
resource, how often to update the AppWidget, and
(optionally) a configuration Activity to launch at create time.
Create App Widget Layout
• App Widget layouts are based on RemoteViews,
which do not support every kind of layout or
view widget.
• A RemoteViews object (and, consequently, an
App Widget) can support the following layouts
and Widget classes
Write AppWidgetProvider Class
The AppWidgetProvider class extends BroadcastReceiver as
a convenience class to handle the App Widget broadcasts
• Methods to override
> onUpdate(Context, AppWidgetManager, int[]) - called
when each App Widget is added to a host (unless you
use a configuration Activity), Typically the only
method that needs to be present
> onDeleted(Context, int[])
> onEnabled(Context)
>onDisabled(Context)
> onReceive(Context, Intent)
Why App Widget Configuration Activity?
• If you would like the user to configure settings when he or
she adds a new App Widget, you can create an App Widget
configuration Activity.
• This Activity will be automatically launched by the App
Widget host and allows the user to configure available settings
for the App Widget at create-time, such as the App Widget
colour, size, update period or other functionality settings.
Declare it in Manifest File
• The configuration Activity should be declared as a normal
Activity in the Android manifest file.
• However, it will be launched by the App Widget host with
the ACTION_APPWIDGET_CONFIGURE action, so the Activity
needs to accept this Intent
<activity android:name=".ExampleAppWidgetConfigure">
<intent-filter>
<action
android:name="android.appwidget.action.APPWIDGET_CONFI
GURE" />
</intent-filter>
</activity>
Declare it in Metadata Config file
• Also, the Activity must be declared in the
AppWidgetProviderInfo XML file, with the android:configure
attribute
<appwidget-provider
xmlns:android="http://schemas.android.com/apk/res/android"
...
android:configure="com.example.android.ExampleAppWidgetC
onfigure"
... >
</appwidget-provider>
Thank you

Contenu connexe

Tendances

Mobile Application Development With Android
Mobile Application Development With AndroidMobile Application Development With Android
Mobile Application Development With Androidguest213e237
 
Android resource
Android resourceAndroid resource
Android resourceKrazy Koder
 
Android application development ppt
Android application development pptAndroid application development ppt
Android application development pptGautam Kumar
 
Mobile application development ppt
Mobile application development pptMobile application development ppt
Mobile application development ppttirupathinews
 
Introduction to Android ppt
Introduction to Android pptIntroduction to Android ppt
Introduction to Android pptTaha Malampatti
 
Eclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATIONEclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATIONAYESHA JAVED
 
MVC Architecture
MVC ArchitectureMVC Architecture
MVC ArchitecturePrem Sanil
 
Lecture 1 introduction to vb.net
Lecture 1   introduction to vb.netLecture 1   introduction to vb.net
Lecture 1 introduction to vb.netMUKALU STEVEN
 
Tk2323 lecture 1 introduction to mobile application
Tk2323 lecture 1   introduction to mobile applicationTk2323 lecture 1   introduction to mobile application
Tk2323 lecture 1 introduction to mobile applicationMengChun Lam
 
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
 
Activities, Fragments, and Events
Activities, Fragments, and EventsActivities, Fragments, and Events
Activities, Fragments, and EventsHenry Osborne
 
Introduction To Mobile Application Development
Introduction To Mobile Application DevelopmentIntroduction To Mobile Application Development
Introduction To Mobile Application DevelopmentSyed Absar
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JSArno Lordkronos
 

Tendances (20)

Mobile Application Development With Android
Mobile Application Development With AndroidMobile Application Development With Android
Mobile Application Development With Android
 
Android User Interface
Android User InterfaceAndroid User Interface
Android User Interface
 
Android resource
Android resourceAndroid resource
Android resource
 
Android application development ppt
Android application development pptAndroid application development ppt
Android application development ppt
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
Nodejs presentation
Nodejs presentationNodejs presentation
Nodejs presentation
 
Mobile application development ppt
Mobile application development pptMobile application development ppt
Mobile application development ppt
 
Introduction to Android ppt
Introduction to Android pptIntroduction to Android ppt
Introduction to Android ppt
 
Eclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATIONEclipse introduction IDE PRESENTATION
Eclipse introduction IDE PRESENTATION
 
MVC Architecture
MVC ArchitectureMVC Architecture
MVC Architecture
 
Lecture 1 introduction to vb.net
Lecture 1   introduction to vb.netLecture 1   introduction to vb.net
Lecture 1 introduction to vb.net
 
Tk2323 lecture 1 introduction to mobile application
Tk2323 lecture 1   introduction to mobile applicationTk2323 lecture 1   introduction to mobile application
Tk2323 lecture 1 introduction to mobile application
 
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
 
Activities, Fragments, and Events
Activities, Fragments, and EventsActivities, Fragments, and Events
Activities, Fragments, and Events
 
Google Maps in Android
Google Maps in AndroidGoogle Maps in Android
Google Maps in Android
 
Introduction To Mobile Application Development
Introduction To Mobile Application DevelopmentIntroduction To Mobile Application Development
Introduction To Mobile Application Development
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JS
 
Android ppt
Android pptAndroid ppt
Android ppt
 
Android UI
Android UIAndroid UI
Android UI
 
Broadcast receivers
Broadcast receiversBroadcast receivers
Broadcast receivers
 

En vedette

k12020 control theory ppt
k12020 control theory pptk12020 control theory ppt
k12020 control theory pptSourabh Gupta
 
Dane estetik laser
Dane estetik laserDane estetik laser
Dane estetik laserEstetikLaser
 
50-Behavior-Based-Interview-Questions
50-Behavior-Based-Interview-Questions50-Behavior-Based-Interview-Questions
50-Behavior-Based-Interview-QuestionsAnirud Raghava
 
Mike Meo, Harvard GSD Core Portfolio
Mike Meo, Harvard GSD Core PortfolioMike Meo, Harvard GSD Core Portfolio
Mike Meo, Harvard GSD Core PortfolioMichael Meo
 
OPERATE ROUGH TERAIN EQUIPMENT
OPERATE ROUGH TERAIN EQUIPMENTOPERATE ROUGH TERAIN EQUIPMENT
OPERATE ROUGH TERAIN EQUIPMENTLindsay Fritz
 
Новые направления развития на рынке металлосервисных услуг. Опыт СПК
Новые направления развития на рынке металлосервисных услуг. Опыт СПКНовые направления развития на рынке металлосервисных услуг. Опыт СПК
Новые направления развития на рынке металлосервисных услуг. Опыт СПКMetal Supply&Sales Magazine
 
Microcontrollori
MicrocontrolloriMicrocontrollori
Microcontrollorisamu97
 
Equazione della circonferenza
Equazione della circonferenzaEquazione della circonferenza
Equazione della circonferenzaRedooc
 
Android Notifications in Android Nougat 7.0
Android Notifications in Android Nougat 7.0Android Notifications in Android Nougat 7.0
Android Notifications in Android Nougat 7.0Gracia Marcom
 
Business environment
Business environmentBusiness environment
Business environmentpraveenwwars
 

En vedette (18)

Fernando cembranos
Fernando cembranosFernando cembranos
Fernando cembranos
 
Levantam10
Levantam10Levantam10
Levantam10
 
test32renamed
test32renamedtest32renamed
test32renamed
 
k12020 control theory ppt
k12020 control theory pptk12020 control theory ppt
k12020 control theory ppt
 
Dane estetik laser
Dane estetik laserDane estetik laser
Dane estetik laser
 
50-Behavior-Based-Interview-Questions
50-Behavior-Based-Interview-Questions50-Behavior-Based-Interview-Questions
50-Behavior-Based-Interview-Questions
 
Jeff Moriarty, Johnston Press
Jeff Moriarty, Johnston PressJeff Moriarty, Johnston Press
Jeff Moriarty, Johnston Press
 
Mike Meo, Harvard GSD Core Portfolio
Mike Meo, Harvard GSD Core PortfolioMike Meo, Harvard GSD Core Portfolio
Mike Meo, Harvard GSD Core Portfolio
 
Lakhan singh
Lakhan singhLakhan singh
Lakhan singh
 
OPERATE ROUGH TERAIN EQUIPMENT
OPERATE ROUGH TERAIN EQUIPMENTOPERATE ROUGH TERAIN EQUIPMENT
OPERATE ROUGH TERAIN EQUIPMENT
 
Новые направления развития на рынке металлосервисных услуг. Опыт СПК
Новые направления развития на рынке металлосервисных услуг. Опыт СПКНовые направления развития на рынке металлосервисных услуг. Опыт СПК
Новые направления развития на рынке металлосервисных услуг. Опыт СПК
 
Microcontrollori
MicrocontrolloriMicrocontrollori
Microcontrollori
 
Equazione della circonferenza
Equazione della circonferenzaEquazione della circonferenza
Equazione della circonferenza
 
Trabajo3 sem4 gogoc
Trabajo3 sem4 gogocTrabajo3 sem4 gogoc
Trabajo3 sem4 gogoc
 
Android Notifications in Android Nougat 7.0
Android Notifications in Android Nougat 7.0Android Notifications in Android Nougat 7.0
Android Notifications in Android Nougat 7.0
 
Business environment
Business environmentBusiness environment
Business environment
 
Abdomen agudo
Abdomen agudoAbdomen agudo
Abdomen agudo
 
Medio natural
Medio naturalMedio natural
Medio natural
 

Similaire à Android Widget

Android appwidget
Android appwidgetAndroid appwidget
Android appwidgetKrazy Koder
 
FlutterArchitecture FlutterArchitecture.ppt
FlutterArchitecture FlutterArchitecture.pptFlutterArchitecture FlutterArchitecture.ppt
FlutterArchitecture FlutterArchitecture.pptKevinNemo
 
Android Tutorial
Android TutorialAndroid Tutorial
Android TutorialFun2Do Labs
 
Beginning android
Beginning android Beginning android
Beginning android Igor R
 
Dicoding Developer Coaching #21: Android | Cara Membuat Widget di Aplikasi An...
Dicoding Developer Coaching #21: Android | Cara Membuat Widget di Aplikasi An...Dicoding Developer Coaching #21: Android | Cara Membuat Widget di Aplikasi An...
Dicoding Developer Coaching #21: Android | Cara Membuat Widget di Aplikasi An...DicodingEvent
 
Mobile application development
Mobile application developmentMobile application development
Mobile application developmentumesh patil
 
Android Wear, a developer's perspective
Android Wear, a developer's perspectiveAndroid Wear, a developer's perspective
Android Wear, a developer's perspectiveSebastian Vieira
 
Compose camp 4.pptx
Compose camp 4.pptxCompose camp 4.pptx
Compose camp 4.pptxbcedsc
 
Android Development : (Android Studio, PHP, XML, MySQL)
Android Development : (Android Studio, PHP, XML, MySQL)Android Development : (Android Studio, PHP, XML, MySQL)
Android Development : (Android Studio, PHP, XML, MySQL)Kavya Barnadhya Hazarika
 
Android apps development
Android apps developmentAndroid apps development
Android apps developmentMonir Zzaman
 
Workshop Android for Java Developers
Workshop Android for Java DevelopersWorkshop Android for Java Developers
Workshop Android for Java Developersmhant
 
Using And Extending The DotNetNuke Widget Framework
Using And Extending The DotNetNuke Widget FrameworkUsing And Extending The DotNetNuke Widget Framework
Using And Extending The DotNetNuke Widget FrameworkNik Kalyani
 
Web application development process
Web application development processWeb application development process
Web application development processJohn Smith
 
Android App Development - 13 Broadcast receivers and app widgets
Android App Development - 13 Broadcast receivers and app widgetsAndroid App Development - 13 Broadcast receivers and app widgets
Android App Development - 13 Broadcast receivers and app widgetsDiego Grancini
 

Similaire à Android Widget (20)

Android appwidget
Android appwidgetAndroid appwidget
Android appwidget
 
FlutterArchitecture FlutterArchitecture.ppt
FlutterArchitecture FlutterArchitecture.pptFlutterArchitecture FlutterArchitecture.ppt
FlutterArchitecture FlutterArchitecture.ppt
 
Android Tutorial
Android TutorialAndroid Tutorial
Android Tutorial
 
App widget
App widgetApp widget
App widget
 
Beginning android
Beginning android Beginning android
Beginning android
 
Dicoding Developer Coaching #21: Android | Cara Membuat Widget di Aplikasi An...
Dicoding Developer Coaching #21: Android | Cara Membuat Widget di Aplikasi An...Dicoding Developer Coaching #21: Android | Cara Membuat Widget di Aplikasi An...
Dicoding Developer Coaching #21: Android | Cara Membuat Widget di Aplikasi An...
 
Mobile application development
Mobile application developmentMobile application development
Mobile application development
 
Android Wear, a developer's perspective
Android Wear, a developer's perspectiveAndroid Wear, a developer's perspective
Android Wear, a developer's perspective
 
Compose camp 4.pptx
Compose camp 4.pptxCompose camp 4.pptx
Compose camp 4.pptx
 
Android Development : (Android Studio, PHP, XML, MySQL)
Android Development : (Android Studio, PHP, XML, MySQL)Android Development : (Android Studio, PHP, XML, MySQL)
Android Development : (Android Studio, PHP, XML, MySQL)
 
Android Development Basics
Android Development BasicsAndroid Development Basics
Android Development Basics
 
Android by Swecha
Android by SwechaAndroid by Swecha
Android by Swecha
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
 
Workshop Android for Java Developers
Workshop Android for Java DevelopersWorkshop Android for Java Developers
Workshop Android for Java Developers
 
Using And Extending The DotNetNuke Widget Framework
Using And Extending The DotNetNuke Widget FrameworkUsing And Extending The DotNetNuke Widget Framework
Using And Extending The DotNetNuke Widget Framework
 
Web application development process
Web application development processWeb application development process
Web application development process
 
Android components
Android componentsAndroid components
Android components
 
Ui 5
Ui   5Ui   5
Ui 5
 
Android App Development - 13 Broadcast receivers and app widgets
Android App Development - 13 Broadcast receivers and app widgetsAndroid App Development - 13 Broadcast receivers and app widgets
Android App Development - 13 Broadcast receivers and app widgets
 
Mobile Application Development class 003
Mobile Application Development class 003Mobile Application Development class 003
Mobile Application Development class 003
 

Dernier

On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 

Dernier (20)

On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 

Android Widget

  • 2. Topics  What is an App Widget? App Widget framework Steps for creating an App Widget Creating App Widget configuration Activity
  • 3. What is App Widget? Widgets are an essential aspect of home screen customization. You can imagine them as "at-a-glance" views of an app's most important data and functionality that is accessible right from the user's home screen.
  • 4. Usage Examples of App Widgets • People can drop widgets onto their home screen and interact. • Widgets can provide a quick glimpse into fully featured apps, such as showing upcoming calendar events, or viewing details about a song playing in the background. • Users can also interact with your app through the widget, for example pausing or switching music tracks.
  • 5. AppWidget Framework • AppWidgetProviderInfo object > Describes the metadata for an App Widget, such as the App Widget's layout, update frequency, and the AppWidgetProvider class. > This should be defined in XML.
  • 6. AppWidget Framework • AppWidgetProvider class > Defines the basic methods that allow you to programmatically interface with the App Widget, based on broadcast events. (AppWidgetProvider class is a child class of BroadcastReceiver class.) > Through it, you will receive broadcasts when the App Widget is updated, enabled, disabled and deleted.
  • 7. AppWidget Framework(cont..) • View layout > Defines the initial layout for the App Widget, defined in XML. • Additionally, you can implement an App Widget configuration Activity.
  • 8. Steps for Building an App Widget Declare an AppWidgetProvider in the Manifest file Create the AppWidgetProviderInfo Metadata XML file Create the App Widget Layout XML file Write the AppWidgetProvider Class
  • 9. Declare AppWidgetProvider in Manifest • The <receiver> element requires the android:name attribute, which specifies the AppWidgetProvider • The <intent-filter> element must include an <action> element with the android:name attribute. This attribute specifies that the AppWidgetProvider accepts the ACTION_APPWIDGET_UPDATE broadcast. • The <meta-data> element specifies the location
  • 10. Create AppWidgetProviderInfo Metadata • Define the AppWidgetProviderInfo object in an XML resource using a single <appwidget-provider> element and save it in the project's res/xml/ folder. > This file is referenced from the manifest file • Defines the essential qualities of an App Widget, such as its minimum layout dimensions, its initial layout resource, how often to update the AppWidget, and (optionally) a configuration Activity to launch at create time.
  • 11. Create App Widget Layout • App Widget layouts are based on RemoteViews, which do not support every kind of layout or view widget. • A RemoteViews object (and, consequently, an App Widget) can support the following layouts and Widget classes
  • 12. Write AppWidgetProvider Class The AppWidgetProvider class extends BroadcastReceiver as a convenience class to handle the App Widget broadcasts • Methods to override > onUpdate(Context, AppWidgetManager, int[]) - called when each App Widget is added to a host (unless you use a configuration Activity), Typically the only method that needs to be present > onDeleted(Context, int[]) > onEnabled(Context) >onDisabled(Context) > onReceive(Context, Intent)
  • 13. Why App Widget Configuration Activity? • If you would like the user to configure settings when he or she adds a new App Widget, you can create an App Widget configuration Activity. • This Activity will be automatically launched by the App Widget host and allows the user to configure available settings for the App Widget at create-time, such as the App Widget colour, size, update period or other functionality settings.
  • 14. Declare it in Manifest File • The configuration Activity should be declared as a normal Activity in the Android manifest file. • However, it will be launched by the App Widget host with the ACTION_APPWIDGET_CONFIGURE action, so the Activity needs to accept this Intent <activity android:name=".ExampleAppWidgetConfigure"> <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_CONFI GURE" /> </intent-filter> </activity>
  • 15. Declare it in Metadata Config file • Also, the Activity must be declared in the AppWidgetProviderInfo XML file, with the android:configure attribute <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" ... android:configure="com.example.android.ExampleAppWidgetC onfigure" ... > </appwidget-provider>