Java Question ListWidget


Active Member
Licensed User
I believe that the questions about the libraries for Widgets with "Collection Views" - listview, stackview etc. has been asked before. I need to use a ListView Widget, but I am not sure how to start with the library.
I have found an example of WeatherListWidget (see attached file).
It basically has two classes WeatherWidgetService which extends RemoteViewsService and StackRemoteViewsFactory implements RemoteViewsService.RemoteViewsFactory.
public class WeatherWidgetService extends RemoteViewsService {
    public RemoteViewsFactory onGetViewFactory(Intent intent) {
        return new StackRemoteViewsFactory(this.getApplicationContext(), intent);
class StackRemoteViewsFactory implements RemoteViewsService.RemoteViewsFactory {
    private Context mContext;
    private Cursor mCursor;
    private int mAppWidgetId;

    public StackRemoteViewsFactory(Context context, Intent intent) {
        mContext = context;
        mAppWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
I would like to create a service module in the application (which for this example would be WeatherWidgetService) and create a widget. Widget layout is created in the xml file.

Any suggestions, help how to create a wrapper for the library? I think that would be a few people that would be interested in this library.
I would appreciate any help. I have spent a few days trying to look at different libraries but I am not sure how to do it. I am not a Java person. I am not sure whether it is an easy task. I am quite happy with the widget layout being created in the xml file.