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

    <legend id='QRcuy'><style id='QRcuy'><dir id='QRcuy'><q id='QRcuy'></q></dir></style></legend>
  1. <tfoot id='QRcuy'></tfoot>
      • <bdo id='QRcuy'></bdo><ul id='QRcuy'></ul>

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

      Android 小部件未更新

      时间:2023-09-08
        <tbody id='x4pLE'></tbody>
      • <bdo id='x4pLE'></bdo><ul id='x4pLE'></ul>
        1. <legend id='x4pLE'><style id='x4pLE'><dir id='x4pLE'><q id='x4pLE'></q></dir></style></legend>
            <i id='x4pLE'><tr id='x4pLE'><dt id='x4pLE'><q id='x4pLE'><span id='x4pLE'><b id='x4pLE'><form id='x4pLE'><ins id='x4pLE'></ins><ul id='x4pLE'></ul><sub id='x4pLE'></sub></form><legend id='x4pLE'></legend><bdo id='x4pLE'><pre id='x4pLE'><center id='x4pLE'></center></pre></bdo></b><th id='x4pLE'></th></span></q></dt></tr></i><div id='x4pLE'><tfoot id='x4pLE'></tfoot><dl id='x4pLE'><fieldset id='x4pLE'></fieldset></dl></div>
          1. <small id='x4pLE'></small><noframes id='x4pLE'>

              <tfoot id='x4pLE'></tfoot>

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

                问题描述

                我正在尝试实现一个简单的小部件以在主屏幕上显示.我遇到的问题是 onUpdate 在我安装小部件时只被调用一次.配置如下.注意:我不会将更新周期设置为 20 秒,因为我知道这会耗尽电池(只是测试).

                I am trying to implement a simple widget for display on the home screen. The problem I am experiencing is that onUpdate is only being called once when I install the widget. The configuration is below. Note: I will not leave update period at 20 secs as I know that would kill battery (just testing).

                配置:

                <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
                   android:minWidth="294dp"
                   android:minHeight="72dp"
                   android:updatePeriodMillis="20000"
                   android:initialLayout="@layout/my_custom_app_widget">`
                </appwidget-provider>`
                

                清单摘录:

                <receiver android:name="MyCustomWidgetProvider">
                    <intent-filter>
                        <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
                    </intent-filter>
                    <meta-data android:name="android.appwidget.provider"
                        android:resource="@xml/my_custom_app_widget_info" />
                </receiver>
                

                我在安装小部件时观察到以下行为:在我的 WidgetProvider 类中调用 onReceive,然后调用 onEnabled,然后调用 onReceive,然后调用 onUpdate.

                I am observing the following behavior when I install the widget: In my WidgetProvider class on onReceive is called then onEnabled then onReceive, then onUpdate.

                之后,小部件将显示,并且永远不会再次调用 onUpdate.当调用 onUpdate 并且上面 XML 中设置的所有内容(例如更新周期)都正确时,我还会检查提供者的设置.

                After that the widget displays and onUpdate is never called again. I also inspect the settings of the provder when onUpdate is called and everything set in XML above (e.g. update period) is correct.

                推荐答案

                虽然您将 android:updatePeriodMillis 设置为 20 秒,但实际最短时间为 30 分钟.因此,如果您在测试期间没有等待 30 分钟以查看是否有更新,则需要再等待一段时间.

                While you have android:updatePeriodMillis set to 20 seconds, the minimum actual time is 30 minutes. So, if you have not been waiting 30 minutes to see if there is an update during your testing, you will need to wait a bit longer.

                这篇关于Android 小部件未更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:数字选择器对话框 下一篇:如何在 Android Widget 上实现 Button

                相关文章

                1. <small id='HRVmN'></small><noframes id='HRVmN'>

                    <tfoot id='HRVmN'></tfoot>

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

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