

{"id":77320,"date":"2020-03-25T17:08:17","date_gmt":"2020-03-25T11:38:17","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=77320"},"modified":"2021-02-25T16:06:23","modified_gmt":"2021-02-25T10:36:23","slug":"android-widgets","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/android-widgets\/","title":{"rendered":"Android Widgets &#8211; Implement your favourite widgets with ease"},"content":{"rendered":"<p>In this article, we will learn about <strong>Android Widgets<\/strong>.\u00a0Widgets are the UI components that enable users to interact with the app while saving their time. These are actually one of the best features of the android app as they display the information to the users on their screen. To understand clearly, one can define them as small gadgets or controls of one application.<\/p>\n<p>The best example of it can be the Weather forecast and the Clock, that is used by almost all the users of Android.<\/p>\n<p><em><strong>Explore Android Application <a href=\"https:\/\/data-flair.training\/blogs\/android-application-components\/\">Components<\/a> with DataFlair<\/strong><\/em><\/p>\n<p>To create it, we need to define in its layout file as:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;appwidget-provider\r\nxmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n   android:initialLayout=\"@layout\/activity_main\"\r\n   android:minWidth=\"200dp\"\r\n   android:minHeight=\"200dp\"&gt;\r\n&lt;\/appwidget-provider&gt;\r\n<\/pre>\n<p>After we have defined it, we would create a java file, where it is important to declare two things that are :<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">PendingIntent pending_intent = PendingIntent.getActivity(context, 0, intent_new, 0);\r\nRemoteViews r_views = new RemoteViews(context.getPackageName(), R.layout.activity_main);\r\n<\/pre>\n<p>Following are certain methods, that are defined in this class which helps to customize the widgets:<\/p>\n<ul>\n<li><strong>onDelete()<\/strong>: The system calls it when some AppWidgetProvider is deleted.<\/li>\n<li><strong>onEnabled():<\/strong> The system calls it when AppWidgetProvider is created.<\/li>\n<li><strong>onDisabled():<\/strong> The system calls it when the last instance of AppWidgetProvider is deleted.<\/li>\n<li><strong>onReceive():<\/strong> The system calls it to dispatch calls to different methods of the class.<\/li>\n<\/ul>\n<h2>Widget Components<\/h2>\n<p>There are three important components of\u00a0 Android Widgets:<\/p>\n<ol>\n<li><strong>AppWidgetProviderInfo:<\/strong>\u00a0It is the object that defines the metadata of the widget like its layout, updates, etc.<\/li>\n<li><strong>AppWidgetProvider:<\/strong> It is for paging over a collection of objects where no. of pages is undefined.<\/li>\n<li><strong>View Layout:<\/strong> It defines the initial layout of the Widget and is defined in the xml file.<\/li>\n<\/ol>\n<h3>Adding Widget to our application<\/h3>\n<p><span style=\"font-weight: 400\">To add a widget file in our application we need the following files:<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400\"><b>XML definition file:<\/b><span style=\"font-weight: 400\"> This file is required as it instantiates the widget and all the attributes that are required to support it. You can find it in app\/ res\/ values\/.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><b>Java file:<\/b><span style=\"font-weight: 400\"> This file implements the behavior of the widgets. It is found in app\/java\/example\/.<\/span><\/li>\n<li><b>Layout FIle:<\/b><span style=\"font-weight: 400\"> This file is optional and is present in app\/ res\/ layout\/. It defines how the widget layout would look like. <\/span><\/li>\n<\/ol>\n<h3>Types of Android Widgets<\/h3>\n<p>Before getting into the implementation of the widgets, let us see its types:<\/p>\n<p>1. <strong>Information Widgets:<\/strong> This type of widget are generally used to give some important information to the users. This information can be Time clocks or weather information.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/information-Widget.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-77400 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/information-Widget.png\" alt=\"Information widget in Android \" width=\"300\" height=\"152\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/information-Widget.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/information-Widget-150x76.png 150w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>2. <strong>Collection Widgets:<\/strong> These widgets are the types of widgets where many elements of the same type are shown as a collection. In the collection widget, the users can scroll vertically.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Collection-widget.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-77401 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Collection-widget.png\" alt=\"Collection Widget in Android \" width=\"198\" height=\"241\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Collection-widget.png 198w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Collection-widget-123x150.png 123w\" sizes=\"auto, (max-width: 198px) 100vw, 198px\" \/><\/a><\/p>\n<p>3. <strong>Control widgets:<\/strong> The control widgets are used for the purpose of display function that might be required by the users. Such as mobile data, torch, lock screen, WiFi, GPS, brightness, etc.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/control-Widget-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-77402 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/control-Widget-1.jpg\" alt=\"Control Widget in Android \" width=\"300\" height=\"86\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/control-Widget-1.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/control-Widget-1-150x43.jpg 150w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>4. <strong>Hybrid Widgets:<\/strong> Hybrid widgets are those that tend to combine the two or more of the above types of widgets. Such as Music player, Keep note, etc.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/hybrid-widgets.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-77403 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/hybrid-widgets.png\" alt=\"hybrid Widget in Android \" width=\"270\" height=\"50\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/hybrid-widgets.png 270w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/hybrid-widgets-150x28.png 150w\" sizes=\"auto, (max-width: 270px) 100vw, 270px\" \/><\/a><\/p>\n<h3>Implementation of Android Widgets<\/h3>\n<p>Now see how you can implement it in your application. Following is the step-by-step process to implement it in your application:<\/p>\n<p><strong>Step 1:<\/strong> First of all, create a new project and name it. I have named it <strong>\u201cMy Widget\u201d<\/strong>.<\/p>\n<p><strong>Step 2:<\/strong> Next, you have to write the following in your <strong>activity_main.xml<\/strong> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;LinearLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n   android:layout_width=\"match_parent\"\r\n   android:layout_height=\"match_parent\"\r\n   android:orientation=\"vertical\"&gt;\r\n   \/\/This will be displayed in the widget\r\n   &lt;TextView\r\n       android:id=\"@+id\/text_view\"\r\n       android:layout_width=\"wrap_content\"\r\n       android:layout_height=\"wrap_content\"\r\n       android:layout_gravity=\"center\"\r\n       android:layout_marginTop=\"100dp\"\r\n       android:text=\"DataFlair\"\r\n       android:textSize=\"18dp\" \/&gt;\r\n   \/\/this is a button, with name\r\n   &lt;Button\r\n       android:id=\"@+id\/btn\"\r\n       android:layout_width=\"wrap_content\"\r\n       android:layout_height=\"wrap_content\"\r\n       android:layout_gravity=\"center\"\r\n       android:text=\"My Widget\" \/&gt;\r\n&lt;\/LinearLayout&gt;\r\n<\/pre>\n<p><strong>Step 3:<\/strong> Write the following in the <strong>MainActivity.java<\/strong> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.DataFlair.my_widget;\r\n\r\nimport android.os.Bundle;\r\n\r\nimport androidx.appcompat.app.AppCompatActivity;\r\n\r\npublic class MainActivity extends AppCompatActivity {\r\n   @Override\r\n   protected void onCreate(Bundle savedInstanceState) {\r\n       super.onCreate(savedInstanceState);\r\n       setContentView(R.layout.activity_main);\r\n   }\r\n}\r\n<\/pre>\n<p><strong>Step 4:<\/strong>\u00a0 Write the following in the <strong>my_widget_activity.java<\/strong> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.DataFlair.my_widget;\r\n\r\nimport android.app.PendingIntent;\r\nimport android.appwidget.AppWidgetManager;\r\nimport android.appwidget.AppWidgetProvider;\r\nimport android.content.Context;\r\nimport android.content.Intent;\r\nimport android.net.Uri;\r\nimport android.widget.RemoteViews;\r\nimport android.widget.Toast;\r\n\r\npublic class my_widget_activity extends AppWidgetProvider {\r\n   \/\/This is onUpdate method, where we've passed AppWidgetManager and the Widget ID.\r\n   public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] widgetIds) {\r\n       \/\/In this loop, Pending Intent is created which will take us to the URL that we\u2019ve mentioned and a toast would be generated informing that the widget has been added.\r\n       for (int i = 0; i &lt; widgetIds.length; i++) {\r\n           int my_widgetId = widgetIds[i];\r\n           String url = \"https:\/\/data-flair.training\/\";\r\n           Intent intent_new = new Intent(Intent.ACTION_VIEW);\r\n           intent_new.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\r\n           intent_new.setData(Uri.parse(url));\r\n           PendingIntent pending_intent = PendingIntent.getActivity(context, 0, intent_new, 0);\r\n           RemoteViews r_views = new RemoteViews(context.getPackageName(), R.layout.activity_main);\r\n           r_views.setOnClickPendingIntent(R.id.btn, pending_intent);\r\n           appWidgetManager.updateAppWidget(my_widgetId, r_views);\r\n           Toast.makeText(context, \"widget has been added\", Toast.LENGTH_SHORT).show();\r\n       }\r\n   }\r\n}\r\n<\/pre>\n<p><strong>Step 5:<\/strong> Create a new folder xml in the resource folder, and in that create an xml layout file and name it widget.xml. After this, write the following in the <strong>widget.xml<\/strong> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;appwidget-provider\r\nxmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n   android:initialLayout=\"@layout\/activity_main\"\r\n   android:minWidth=\"200dp\"\r\n   android:minHeight=\"200dp\"\r\n   android:updatePeriodMillis=\"0\"&gt;\r\n&lt;\/appwidget-provider&gt;<\/pre>\n<p><strong>Step 6:\u00a0<\/strong> And add the following the <strong>manifest.xml<\/strong> file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;manifest xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\r\n   package=\"com.DataFlair.my_widget\"&gt;\r\n\r\n   &lt;application\r\n       android:allowBackup=\"true\"\r\n       android:icon=\"@mipmap\/ic_launcher\"\r\n       android:label=\"@string\/app_name\"\r\n       android:roundIcon=\"@mipmap\/ic_launcher_round\"\r\n       android:supportsRtl=\"true\"\r\n       android:theme=\"@style\/AppTheme\"&gt;\r\n       &lt;activity android:name=\"com.DataFlair.my_widget.MainActivity\"&gt;\r\n           &lt;intent-filter&gt;\r\n               &lt;action android:name=\"android.intent.action.MAIN\" \/&gt;\r\n               &lt;category android:name=\"android.intent.category.LAUNCHER\" \/&gt;\r\n           &lt;\/intent-filter&gt;\r\n       &lt;\/activity&gt;\r\n       &lt;receiver android:name=\"com.DataFlair.my_widget.my_widget_activity\"&gt;\r\n           &lt;intent-filter&gt;\r\n               &lt;action android:name=\"android.appwidget.action.APPWIDGET_UPDATE\"&gt;&lt;\/action&gt;\r\n           &lt;\/intent-filter&gt;\r\n           &lt;meta-data\r\n               android:name=\"android.appwidget.provider\"\r\n               android:resource=\"@xml\/widget\"&gt;&lt;\/meta-data&gt;\r\n       &lt;\/receiver&gt;\r\n       &lt;meta-data\r\n           android:name=\"preloaded_fonts\"\r\n           android:resource=\"@array\/preloaded_fonts\" \/&gt;\r\n   &lt;\/application&gt;\r\n&lt;\/manifest&gt;\r\n<\/pre>\n<p>This is what our application would look like:<\/p>\n<p><strong>a)<\/strong> This is the application-<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/DataFlair-widget.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-77404 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/DataFlair-widget.png\" alt=\"Dataflair Widget\" width=\"300\" height=\"533\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/DataFlair-widget.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/DataFlair-widget-84x150.png 84w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/DataFlair-widget-169x300.png 169w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\n<strong>b)<\/strong> This is the widget of our application-<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Widget-in-application.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-77405 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Widget-in-application.png\" alt=\"Widget in application\" width=\"300\" height=\"533\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Widget-in-application.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Widget-in-application-84x150.png 84w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/Widget-in-application-169x300.png 169w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\n<strong>c)\u00a0<\/strong>This is how the intent will be working-<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/runing-of-Android-widget.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77408\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/runing-of-Android-widget.gif\" alt=\"\" width=\"288\" height=\"604\" \/><\/a><\/p>\n<h2>Summary<\/h2>\n<p>Coming to the end, we have discussed Android Widgets in this article. We have seen how we can declare widgets in the xml file, and important methods to customize it. Also, we have implemented it in our application. Now that you are well-aware of it, it is your turn to implement and see how interesting it can be.<\/p>\n<p>I hope you like this article and understood about Android Widgets, do rate us on <a href=\"https:\/\/g.page\/DataFlair\/review?kd\">google<\/a> for more such interesting blogs.<\/p>\n<p>Keep Learning\u00a0<img decoding=\"async\" class=\"emoji\" src=\"https:\/\/s.w.org\/images\/core\/emoji\/11\/svg\/1f600.svg\" alt=\"\ud83d\ude00\" \/><span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:1144,&quot;href&quot;:&quot;https:\\\/\\\/g.page\\\/DataFlair\\\/review?kd&quot;,&quot;archived_href&quot;:&quot;&quot;,&quot;redirect_href&quot;:&quot;https:\\\/\\\/g.page\\\/DataFlair\\\/review\\\/?kd&quot;,&quot;checks&quot;:[],&quot;broken&quot;:false,&quot;last_checked&quot;:null,&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will learn about Android Widgets.\u00a0Widgets are the UI components that enable users to interact with the app while saving their time. These are actually one of the best features of&#46;&#46;&#46;<\/p>\n","protected":false},"author":7,"featured_media":77407,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18722],"tags":[22157,22135,22141,22140,22139,22156,22138,22137,22142,22136],"class_list":["post-77320","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","tag-android-widget-implementation","tag-android-widgets","tag-control-widgets","tag-hybrid-widgets","tag-informative-widgets","tag-types-of-android-widgets","tag-types-of-widgets","tag-widget-components","tag-widget-in-android","tag-widgets-in-android"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Android Widgets - Implement your favourite widgets with ease - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn to add Android Widgets in your android application. Also get to know about the different type of Android Widgets and learn how to implement it with ease.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/android-widgets\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android Widgets - Implement your favourite widgets with ease - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn to add Android Widgets in your android application. Also get to know about the different type of Android Widgets and learn how to implement it with ease.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/android-widgets\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-25T11:38:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-02-25T10:36:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-widgets-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android Widgets - Implement your favourite widgets with ease - DataFlair","description":"Learn to add Android Widgets in your android application. Also get to know about the different type of Android Widgets and learn how to implement it with ease.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/android-widgets\/","og_locale":"en_US","og_type":"article","og_title":"Android Widgets - Implement your favourite widgets with ease - DataFlair","og_description":"Learn to add Android Widgets in your android application. Also get to know about the different type of Android Widgets and learn how to implement it with ease.","og_url":"https:\/\/data-flair.training\/blogs\/android-widgets\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2020-03-25T11:38:17+00:00","article_modified_time":"2021-02-25T10:36:23+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-widgets-1.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/android-widgets\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/android-widgets\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd"},"headline":"Android Widgets &#8211; Implement your favourite widgets with ease","datePublished":"2020-03-25T11:38:17+00:00","dateModified":"2021-02-25T10:36:23+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/android-widgets\/"},"wordCount":705,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/android-widgets\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-widgets.jpg","keywords":["android widget implementation","Android Widgets","Control Widgets","hybrid Widgets","Informative widgets","types of android widgets","Types of Widgets","Widget Components","widget in android","widgets in Android"],"articleSection":["Android Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/android-widgets\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/android-widgets\/","url":"https:\/\/data-flair.training\/blogs\/android-widgets\/","name":"Android Widgets - Implement your favourite widgets with ease - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/android-widgets\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/android-widgets\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-widgets.jpg","datePublished":"2020-03-25T11:38:17+00:00","dateModified":"2021-02-25T10:36:23+00:00","description":"Learn to add Android Widgets in your android application. Also get to know about the different type of Android Widgets and learn how to implement it with ease.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/android-widgets\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/android-widgets\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/android-widgets\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-widgets.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/03\/android-widgets.jpg","width":802,"height":420,"caption":"Android Widgets"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/android-widgets\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Android Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/android\/"},{"@type":"ListItem","position":3,"name":"Android Widgets &#8211; Implement your favourite widgets with ease"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team specializes in creating clear, actionable content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Backed by industry expertise, we make learning easy and career-oriented for beginners and pros alike.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam3\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/77320","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=77320"}],"version-history":[{"count":22,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/77320\/revisions"}],"predecessor-version":[{"id":77428,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/77320\/revisions\/77428"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/77407"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=77320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=77320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=77320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}