Example of using loadLabel(android.content.pm.PackageManager) to set a label to Android Widget
Asked Answered
S

1

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.

Shelah answered 13/9, 2015 at 4:39 Comment(1)
I have this same issue. I have not found any examples of how to do this. Anyone?Horrendous
Z
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...

Zarla answered 10/9, 2021 at 8:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.