<bdo id='kifgX'></bdo><ul id='kifgX'></ul>

<small id='kifgX'></small><noframes id='kifgX'>

      <i id='kifgX'><tr id='kifgX'><dt id='kifgX'><q id='kifgX'><span id='kifgX'><b id='kifgX'><form id='kifgX'><ins id='kifgX'></ins><ul id='kifgX'></ul><sub id='kifgX'></sub></form><legend id='kifgX'></legend><bdo id='kifgX'><pre id='kifgX'><center id='kifgX'></center></pre></bdo></b><th id='kifgX'></th></span></q></dt></tr></i><div id='kifgX'><tfoot id='kifgX'></tfoot><dl id='kifgX'><fieldset id='kifgX'></fieldset></dl></div>
    1. <legend id='kifgX'><style id='kifgX'><dir id='kifgX'><q id='kifgX'></q></dir></style></legend>
      <tfoot id='kifgX'></tfoot>

        两个带有 PendingIntents 的按钮 - 小部件

        时间:2023-09-08
      1. <legend id='N0Owz'><style id='N0Owz'><dir id='N0Owz'><q id='N0Owz'></q></dir></style></legend>

        • <tfoot id='N0Owz'></tfoot>
          <i id='N0Owz'><tr id='N0Owz'><dt id='N0Owz'><q id='N0Owz'><span id='N0Owz'><b id='N0Owz'><form id='N0Owz'><ins id='N0Owz'></ins><ul id='N0Owz'></ul><sub id='N0Owz'></sub></form><legend id='N0Owz'></legend><bdo id='N0Owz'><pre id='N0Owz'><center id='N0Owz'></center></pre></bdo></b><th id='N0Owz'></th></span></q></dt></tr></i><div id='N0Owz'><tfoot id='N0Owz'></tfoot><dl id='N0Owz'><fieldset id='N0Owz'></fieldset></dl></div>
            <tbody id='N0Owz'></tbody>

          • <bdo id='N0Owz'></bdo><ul id='N0Owz'></ul>
            1. <small id='N0Owz'></small><noframes id='N0Owz'>

                  本文介绍了两个带有 PendingIntents 的按钮 - 小部件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在创建一个带有两个按钮的小部件.其中一个更新小部件的内容,第二个必须启动一个活动.

                  I'm creating a widget with two buttons. One of them updates the content of the widget and the second one must launch an activity.

                  每个操作我都有两个 PendingIntent,但我不能让它们都工作.如果一个有效,另一个无效.

                  I have two PendingIntent for each action, but I can't make them both work. If one works the other one doesn't.

                  我已经修改了代码,不明白哪里出了问题.

                  I've revised the code and can't understand what's wrong.

                  任何帮助将不胜感激.

                  这是代码.

                      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);
                  

                  推荐答案

                  当一个小部件中有两个或多个按钮时,请查看此链接以了解单击了哪个按钮..

                  Check this link to know which button has been clicked when there is two or more button in a widget..

                  https://stackoverflow.com/a/10733049/1331593

                  它应该可以工作...如果它不工作,请告诉我是什么问题...

                  It should work... IF it does not work please let me know what is the problem...

                  这篇关于两个带有 PendingIntents 的按钮 - 小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何使用本机反应创建 android 小部件? 下一篇:Flutter:SingleChildScrollView 内的 TabBarView

                  相关文章

                    <i id='NSOuk'><tr id='NSOuk'><dt id='NSOuk'><q id='NSOuk'><span id='NSOuk'><b id='NSOuk'><form id='NSOuk'><ins id='NSOuk'></ins><ul id='NSOuk'></ul><sub id='NSOuk'></sub></form><legend id='NSOuk'></legend><bdo id='NSOuk'><pre id='NSOuk'><center id='NSOuk'></center></pre></bdo></b><th id='NSOuk'></th></span></q></dt></tr></i><div id='NSOuk'><tfoot id='NSOuk'></tfoot><dl id='NSOuk'><fieldset id='NSOuk'></fieldset></dl></div>
                        <bdo id='NSOuk'></bdo><ul id='NSOuk'></ul>

                      <tfoot id='NSOuk'></tfoot>
                    1. <small id='NSOuk'></small><noframes id='NSOuk'>

                    2. <legend id='NSOuk'><style id='NSOuk'><dir id='NSOuk'><q id='NSOuk'></q></dir></style></legend>