Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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?

like image 840
kavrecon Avatar asked Dec 27 '10 04:12

kavrecon


People also ask

How do you give a widget a name?

Right-click in the widget title bar and select Rename widget in the context menu. Type and enter the custom name in the text field that appears. The custom name appears in the title bar.

Where is the widget list on Android?

First, touch hold an open space on your home screen. You'll see an option at the bottom of the screen to view the widgets drawer, which is where they dwell until summoned for duty. Select the widgets drawer, then browse through the choices.


1 Answers

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.

like image 101
Falcon Avatar answered Oct 05 '22 18:10

Falcon