在我的小部件中,我编写了一个RemoteViewsService来显示一些图片。下载图像后,我想更新一个视图以显示此图像,我该怎么办?
@Override
public RemoteViews getViewAt(final int position) {
final RemoteViews mRemoteViews = new RemoteViews(context.getPackageName(), R.layout.item_widget);
Glide.with(context).load(HomeWidget.list.get(position).remote).downloadOnly(new SimpleTarget<File>() {
@Override
public void onResourceReady(File resource, GlideAnimation<? super File> glideAnimation) {
HomeWidget.list.get(position).local = Uri.fromFile(resource);
sendBroadcast(new Intent(HomeWidget.IMAGE_LOAD));// this will update all views but not one view.
//how can I update only this view after ?
}