• <legend id='6CE2D'><style id='6CE2D'><dir id='6CE2D'><q id='6CE2D'></q></dir></style></legend>

      <tfoot id='6CE2D'></tfoot>

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

        <bdo id='6CE2D'></bdo><ul id='6CE2D'></ul>
    1. <small id='6CE2D'></small><noframes id='6CE2D'>

        待处理意图的多个实例

        时间:2023-09-08

        <tfoot id='JdRle'></tfoot>

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

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

              <legend id='JdRle'><style id='JdRle'><dir id='JdRle'><q id='JdRle'></q></dir></style></legend>

                <tbody id='JdRle'></tbody>
                <bdo id='JdRle'></bdo><ul id='JdRle'></ul>
                1. 本文介绍了待处理意图的多个实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我创建了一个小部件,单击该小部件会激活 PendingIntent.问题是当屏幕上有多个小部件时,只有最新的小部件会启动 PendingIntent.

                  I created a widget that when clicked activates a PendingIntent. The problem is when I have more than one widget on the screen only the latest one will start the PendingIntent.

                  我已经阅读了一些关于唯一请求代码的信息,但没有弄清楚这一点.

                  I have read some about a unique request code, but not figured this out.

                  有什么想法可以让我拥有多个小部件并且 PendingIntents 可以为每个小部件工作吗?

                  Any ideas how I can have multiple widgets and the PendingIntents work for each?

                  这是我的代码片段:

                  Intent openApp = new Intent(context, RunningTally.class);
                      openApp.putExtra("widgetId", appWidgetId);
                      PendingIntent pendingAppIntent = 
                          PendingIntent.getActivity(context, 0, openApp, PendingIntent.FLAG_CANCEL_CURRENT  );
                      views.setOnClickPendingIntent(R.id.openFull, pendingAppIntent);
                  

                  推荐答案

                  恰好在发布我的问题后,我想出了一个答案.我将 appWidgetId 作为唯一"请求代码传入,瞧!这是现在的片段:

                  So happens that after posting my question, I came up with an answer. I pass in my appWidgetId as the "unique" request code and voila! Here is the snippet now:

                  Intent openApp = new Intent(context, RunningTally.class);
                      openApp.putExtra("widgetId", appWidgetId);
                      PendingIntent pendingAppIntent = 
                          PendingIntent.getActivity(context, appWidgetId, openApp, 
                                                    PendingIntent.FLAG_CANCEL_CURRENT);
                      views.setOnClickPendingIntent(R.id.openFull, pendingAppIntent);
                  

                  这篇关于待处理意图的多个实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何在android中的通知中添加按钮? 下一篇:Android:如何强制更新特定类型的所有小部件

                  相关文章

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

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

                    1. <legend id='yNJoZ'><style id='yNJoZ'><dir id='yNJoZ'><q id='yNJoZ'></q></dir></style></legend>
                      <tfoot id='yNJoZ'></tfoot>