Simple App Widget – Android Studio Tutorial

In this tutorial we will learn, how to create a simple home screen app widget that contains a button and opens the MainActivity when we click it.
For this we will create a widget layout, an AppWidgetProvider class and an AppWidgetProviderInfo xml file. In the AppWidgetProvider java file we will then override onUpdate and create a PendingIntent which brings us to our MainActivity. We set this intent on our widget button with help of the RemoteViews class and then update our widget with the appWidgetManager object. We repeat this process for all instances of our widget by looping through the appWidgetIds int array.
In the app widget info xml file, we define the update frequency with updatePeriodMillis, the widgetCategory, minHeight, minWidth, minResizeWidth, initialLayout and more.
Lastly we register our AppWidgetProvider in the AndroidManifest.xml file as a broadcast receiver with the APPWIDGET_UPDATE intent filter. We register our appwidget info object in the meta data tag with android.appwidget.provider.
Our widget will have a previewImage which we create with help of the Widget Preview app and it will be resizable.

Watch the whole playlist:

App Widget Guidelines:

Example code:

Subscribe to my channel:

Want more Android tutorials? Check my playlist section:

Follow me on social media:





App Widget Part 2 – CONFIGURATION ACTIVITY – Android Studio Tutorial

In part 2 of the app widget tutorial, we add a configuration activity to our app, which starts when our widget is dragged onto the homescreen and where we can do an initial setup. We get our appWidgetId from the intent with the AppWidgetManager.EXTRA_APPWIDGET_ID key and can then make changes to this widget with help of the RemoteViews class. We will give the user the option to set his own button text and as in the last video we set a PendingIntent to our button which will open our MainActivity when clicked. We will also save the button text to SharedPreferences and then finish our activity with RESULT_OK and pass the appWidgetId back. In case we don’t get passed a valid id, our appWidgetId will be set to AppWidgetManager.INVALID_APPWIDGET_ID.
In our AppWidgetProvider class we retrieve the button text from shared preferences in our onUpdate method and reset it together with the pending intent to our button.
In our AndroidManifest.xml file we have to set the android.appwidget.action.APPWIDGET_CONFIGURE intent filter for our config activity and in the info xml file we have to add the android:configure attribute.

Watch the whole playlist:

Example code:

Subscribe to my channel:

Want more Android tutorials? Check my playlist section:

Follow me on social media:





Channel: Coding in Flow
Published: 2018-03-13 23:59:55
Duration: 17M55S
Views: 3211
Likes: 55
Favorites: 0

Top 20 Best Android Apps 2019 | MUST HAVE

Here’s our pick for Best Android Apps 2019.

Best Android Apps 2018 :

Top 20 Best Android Games 2019 :

Apps in this video :

Brilliant :

Unnotification :

Orphic :

Lynx :

1Password :

World Around Me :

Cleanfox :

Musicolet :

Hide :

Away :

Typing Hero :

Walli :

Forest Live Wallpaper : Faster and safer internet :

Phototime :

Apex Weather :

Adobe Spark Post :

Disappointment :

CocoCast :

Shapical X :

Some Bonus Apps You Must Try :
Lens Distortion :

Unfold :
Gbox :

Stuff :

Infact :

Other Videos You Must check out !

Awesome Tech and Gadgets You Must Check Out !

Awesome Tech – Gaming Edition

Awesome Android / iPhone Accessories

Must Have Accessories for Gamers
Cool Gaming Tech Gadgets

Business Enquiry:

Channel: Explore Gadgets
Published: 2019-01-01 18:24:04
Duration: 14M46S
Views: 137318
Likes: 2490
Favorites: 0

Your app, their home screen: Widgets (Android Development Patterns S2 Ep 2)

If you want your app to get noticed, you gotta get in the game. The Widget game, that is. (…) Widgets are literally a window into your app. They let users see key information at a glance, trigger helpful controls with a tap, and even interact with your app without ever needing to open it. Not having one (or several!) sounds like a missed opportunity to me. You don’t want to be a missed opportunity, do you?


Watch more episodes of Android Development Patterns here:

Subscribe to the Android Developers channel at

Channel: Android Developers
Published: 2016-01-20 19:01:16
Duration: 2M30S
Views: 27757
Likes: 204
Favorites: 0

Button Design in Android Studio

Link to create button XML:

Like, Comment, Subscribe!




Channel: Inside Android
Published: 2018-02-01 16:53:57
Duration: 6M44S
Views: 30157
Likes: 306
Favorites: 0

What Is A Widget On Android?

Learn more about widgets at

In this video, I talk about what an Android widget is and show you some examples of what they can do. An Android widget is an app that can run on your home screen without having to be opened up or even attached to any standalone app.

For example, a power control widget allows you to toggle certain wireless connections on and off without it being attached to any app in particular. Yet there are times when a widget is attached to a standalone app, like the scorecenter app which shows you game scores on your homescreen that can lead to opening the full on app when you tap on it.

Why are widgets a good thing? Because they make things or information easier to get to on your Android phone. Want the score to the game? Just look at your widget, no need to open (and wait for) the full app. Want to turn off Wi-Fi? Just tap on the wifi icon in your power control widget instead of having to go through the settings. You get the idea. It just makes things much more convenient.



About PhoneBuff:
It’s not official until it’s done phonebuffstyle! Home of the best smartphone speed tests, drop tests, and battery tests.

Send Products To:
23811 Washington Ave 110-394
Murrieta, CA 92562

What Is A Widget On Android?


Channel: PhoneBuff
Published: 2012-05-09 19:30:00
Duration: 3M48S
Views: 109934
Likes: 751
Favorites: 0

Leave a Reply

Your email address will not be published. Required fields are marked *