I wrote a widget that sits on my home screen.
There is also a configuration activity which can be started from the widget or from the launcher.
When started from launcher, I don't have the widget id.
Is it possible to find it somehow?
The reason is that I want to send an update message from the activity to the widget.
On a Home screen, touch and hold an empty space. Tap Widgets .
To add a widget, you first need to access the widgets drawer. On Google Pixel smartphones, this is done by tapping and holding on a blank space on your Android smartphone's Home Screen (on the wallpaper, not on the icons or on other widgets). This brings up a menu, where you need to choose Widgets.
Widgets are an essential aspect of home screen customization. You can imagine them as "at-a-glance" views of an app's most important data and functionality that is accessible right from the user's home screen.
A widget is an extension of an application. While apps can perform many tasks, widgets generally focus on one task. For example, Android's Clock app lets you set alarms, functions as a stopwatch, manages do-not-disturb settings at bedtime, and more, while the Clock widget simply displays the time on your home screen.
Something like this seems to work for me:
Context context = getApplicationContext();
ComponentName name = new ComponentName(context, MyWidgetProvider.class);
int [] ids = AppWidgetManager.getInstance(context).getAppWidgetIds(name);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With