I intend to create a widget that would consist of a simple button that, when pressed, executes an action.
I've been watching tutorials like this " Widgets SGOliver " , I understand a lot of what they explain there but my problem comes in the part of the Intent and PendingIntent when adding action to a button.
Intent intent = new Intent("net.sgoliver.android.widgets.ACTUALIZAR_WIDGET");
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId);
PendingIntent pendingIntent =
PendingIntent.getBroadcast(context, widgetId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
controles.setOnClickPendingIntent(R.id.BtnActualizar, pendingIntent);
That code causes a button in the widget to update the information in the widget so that it does not have to wait for the automatic update of the widget.
I do not really understand where in the code the button is told to update the information.
I understand that an intent is created with the name of the action and it is passed to it as a parameter in the getBroadcasT()
method, but I do not understand how the button understands that it must update the information (so to speak).
I know that I explain myself fatal but it would be a great help if you could guide me.