Tôi đang tạo một widget có hai nút. Một trong số họ cập nhật nội dung của tiện ích và tiện ích thứ hai phải khởi chạy hoạt động.Hai nút với PendingIntents - Widget
Tôi có hai PendingIntent cho mỗi hành động, nhưng tôi không thể làm cho cả hai hoạt động. Nếu một công trình khác thì không.
Tôi đã sửa đổi mã và không thể hiểu có gì sai.
Mọi trợ giúp sẽ được đánh giá cao.
Đây là mã.
RemoteViews controls = new RemoteViews(context.getPackageName(), R.layout.miwidget);
Intent intent = new Intent("actony.com.ACTUALIZAR_WIDGET");
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId);
Intent intentSettings = new Intent();
intentSettings.setClass(context,WidgetConfig.class);
PendingIntent pendingIntentUpdate = PendingIntent.getBroadcast(context, widgetId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
controls.setOnClickPendingIntent(R.id.BtnActualizar, pendingIntentUpdate);
PendingIntent pendingIntentSettings = PendingIntent.getActivity(context, 0, intentSettings, 0);
controls.setOnClickPendingIntent(R.id.botonSettings, pendingIntentSettings);