Code example for RemoteViews

public abstract class AbstractWidgetUpdater { 
	// This contains the common code for updating all of the different widget sizes. 
	private static String TAG = "2DegreesAbstractWidgetUpdater";
    RemoteViews buildUpdate(Context context, int widgetId, boolean force, FetchResult error) {
    	Log.d(TAG, "Building updates");
    	RemoteViews updateViews = new RemoteViews(context.getPackageName(), getLayoutId());
    	fillRemoteViews(updateViews, context, widgetId, error);
        return updateViews;
    protected abstract String getFriendlyName();
    protected abstract void  fillRemoteViews(RemoteViews updateViews, Context context, int widgetId, FetchResult error);
    protected abstract int getLayoutId(); 
    public String getUpdateDateString(Context context) {
    	SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    	if (sp.getBoolean("last_update_shown", true)) {
			String updateDateString = sp.getString("updateDate", "");
	    	try { 
				Date now = new Date();
				Date lastUpdate = DateFormatters.ISO8601FORMAT.parse(updateDateString);
Experience pair programming with AI  Get Codota for Java