Java Question ListWidget

Discussion in 'Libraries developers questions' started by wes58, Mar 31, 2015.

  1. wes58

    wes58 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.
    Code:
    public class WeatherWidgetService extends RemoteViewsService {
        @Override
        
    public RemoteViewsFactory onGetViewFactory(Intent intent) {
            
    return new StackRemoteViewsFactory(this.getApplicationContext(), intent);
        
    }
    }
    Code:
    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,
                    AppWidgetManager.INVALID_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.
     

    Attached Files:

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice