How do I give a Android App Widget a Label/Name

kavrecon picture kavrecon · Dec 27, 2010 · Viewed 14.4k times · Source

I just finished my first app, it works fine and I've made it a homescreen widget. But it doesn't have the name under it. The tutorial I am following says nothing about it, shouldn't this just be the name of the app and be pulled in automatically?

Answer

Falcon picture Falcon · Jul 17, 2012

You can set the name of your app widget to be displayed in the widget picker by adding android:label="the name of my appwidget" to the receiver that handles appwidget related intents in AndroidManifest.xml. It is documented in a somewhat obscure place: http://developer.android.com/reference/android/appwidget/AppWidgetProviderInfo.html#label

Example of use in AndroidManifest.xml:

<receiver android:name=".widget.MyWidgetProvider" android:label="My App Widget">
   ...
</receiver>

Note: this property was deprecated in API 21, but still works as of API 29.