8

In Android API from API level 21 field label is deprecated and advised to use loadLabel(android.content.pm.PackageManager) instead.

Just curious if anybody happen to find any example of how to use loadLabel(...) to set the label to Android Widget?

Thank you in advance for sharing.

user3735181
  • 103
  • 1
  • 4

1 Answers1

0

I encountered the same issue. I believe the documentation is not very clear on this topic. All you have to do is to define the label in the manifest (AndroidManifest.xml). For example:

<receiver
    android:name=".MyApp"
    android:label="My Widget name" <= This is what you are looking for
    <!-- [...] -->
</receiver>

This defines the widget "name" in the AppWidget picker. At least for me on Android 10...

Plouff
  • 3,290
  • 2
  • 27
  • 45