26

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?

Floern
  • 33,559
  • 24
  • 104
  • 119
kavrecon
  • 261
  • 1
  • 3
  • 3

2 Answers2

59

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.

Lifes
  • 1,226
  • 2
  • 25
  • 45
Falcon
  • 1,317
  • 1
  • 13
  • 30
  • 7
    Example: `` – Quentin S. Oct 29 '14 at 10:37
  • 5
    This doesn't add text under the widget on the home screen on Lollipop. – Etienne Lawlor May 17 '15 at 16:05
  • I don't have a solution for this. I ended up putting text into my app widget. Check out my widget here : https://play.google.com/store/apps/details?id=com.etiennelawlor.eggday – Etienne Lawlor Sep 01 '16 at 21:16
  • 1
    Nice! Note that the correct ref page is for , https://developer.android.com/guide/topics/manifest/receiver-element. This field is not deprecated but it is supplanted in API 31 by android:description on the . – Jerry101 Oct 28 '21 at 22:44
0

You can set it in the AndroidManifest.xml. App Widgets might be of some help.

ninjasense
  • 13,756
  • 19
  • 75
  • 92