I'm implementing widget with listview based on this tutorial: http://laaptu.wordpress.com/2013/07/24/populate-appwidget-listview-with-remote-datadata-from-web/ (source code: https://github.com/laaptu/appwidget-listview/tree/appwidget-listview2/).
ListView item contains text & image, for image loading I use Picasso.
getViewAt implementation:
public RemoteViews getViewAt(int position) {
final RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.listview_item);
ListItem listItem = listItemList.get(position);
remoteView.setTextViewText(R.id.headline, listItem.headline);
final String imageUrl = listItem.image;
handler.post(new Runnable() {
@Override
public void run() {
if (!Utils.isEmpty(imageUrl)) {
picasso.load(imageUrl)
.placeholder(R.drawable.empty_photo)
.into(remoteView, R.id.picture, new int[] { appWidgetId });
}
}
});
return remoteView;
}
When the image loaded, it breaks layout.
What can be a possible problem? Or what am I doing wrong?
Without image loading:
How it looks after image is loaded:
UPDATE:
The same happens if I just add a few nested remote views (all inflated from one layout)
UPDATE2:
Reported an issue: https://github.com/square/picasso/issues/587