0

I am trying to learn list widget with the WeatherListWidget example by Google. Every other place I looked to find info on widget, they used AppWidgetProvider, but in this example they use ContentProvider. I checked to see maybe one inherets the other, so it will make sense, but they don't. I see in the manifest that ContentProvider uses the tag and AppWidgetProvider uses tag, because they inherit from different things.

So if you could just try and help me understand what makes a widget a widget. So doesn't a widget need a class that extends AppWidgetProvider?

Hope I was clear in my question... Thanks.

4

1 回答 1

1

它们根本没有关系。两者都被称为“提供者”,但它们提供不同的东西。

应用程序小部件始终由扩展的类实现AppWidgetProvider在此处阅读有关此课程的信息。

内容提供商做的事情完全不同。引用官方文档

内容提供者管理对结构化数据集的访问。

WeatherListWidget示例同时使用了两者,但每个都有不同的功能:WeatherDataProvideris aContentProvider提供天气数据,WeatherWidgetProvideris anAppWidgetProvider定义小部件本身:

在此处输入图像描述

于 2013-07-04T22:20:52.990 回答