Example usage for android.widget RemoteViews setInt

List of usage examples for android.widget RemoteViews setInt

Introduction

In this page you can find the example usage for android.widget RemoteViews setInt.

Prototype

public void setInt(int viewId, String methodName, int value) 

Source Link

Document

Call a method taking one int on a view in the layout for this RemoteViews.

Usage

From source file:com.devbrackets.android.exomedia.EMNotification.java

/**
 * Updates the images for the play/pause button so that only valid ones are
 * displayed with the correct state.//w w  w . j  av a  2s  .c om
 *
 * @param customNotification The RemoteViews to use to modify the state
 */
private void updateCustomNotificationMediaState(RemoteViews customNotification) {
    NotificationMediaState state = notificationInfo.getMediaState();
    if (customNotification == null || state == null) {
        return;
    }

    customNotification.setImageViewResource(R.id.exomedia_notification_playpause,
            state.isPlaying() ? R.drawable.exomedia_notification_pause : R.drawable.exomedia_notification_play);
    customNotification.setInt(R.id.exomedia_notification_prev, "setVisibility",
            state.isPreviousEnabled() ? View.VISIBLE : View.GONE);
    customNotification.setInt(R.id.exomedia_notification_next, "setVisibility",
            state.isNextEnabled() ? View.VISIBLE : View.GONE);
}

From source file:com.devbrackets.android.playlistcore.helper.NotificationHelper.java

/**
 * Updates the images for the play/pause, next, and previous buttons so that only valid ones are
 * displayed with the correct state./*w  w  w  . ja va  2  s .  co m*/
 *
 * @param bigContent The RemoteViews to use to modify the state
 */
protected void updateBigNotificationMediaState(@Nullable RemoteViews bigContent) {
    NotificationMediaState state = notificationInfo.getMediaState();
    if (bigContent == null || state == null) {
        return;
    }

    bigContent.setImageViewResource(R.id.playlistcore_big_notification_playpause,
            state.isPlaying() ? R.drawable.playlistcore_notification_pause
                    : R.drawable.playlistcore_notification_play);
    bigContent.setInt(R.id.playlistcore_big_notification_prev, "setVisibility",
            state.isPreviousEnabled() ? View.VISIBLE : View.INVISIBLE);
    bigContent.setInt(R.id.playlistcore_big_notification_next, "setVisibility",
            state.isNextEnabled() ? View.VISIBLE : View.INVISIBLE);
}

From source file:com.devbrackets.android.playlistcore.helper.NotificationHelper.java

/**
 * Updates the images for the play/pause button so that only valid ones are
 * displayed with the correct state.//from  w  w w .  ja  va  2 s.  c  om
 *
 * @param customNotification The RemoteViews to use to modify the state
 */
protected void updateCustomNotificationMediaState(@Nullable RemoteViews customNotification) {
    NotificationMediaState state = notificationInfo.getMediaState();
    if (customNotification == null || state == null) {
        return;
    }

    customNotification.setImageViewResource(R.id.playlistcore_notification_playpause,
            state.isPlaying() ? R.drawable.playlistcore_notification_pause
                    : R.drawable.playlistcore_notification_play);
    customNotification.setInt(R.id.playlistcore_notification_prev, "setVisibility",
            state.isPreviousEnabled() ? View.VISIBLE : View.GONE);
    customNotification.setInt(R.id.playlistcore_notification_next, "setVisibility",
            state.isNextEnabled() ? View.VISIBLE : View.GONE);
}

From source file:net.pmarks.chromadoze.NoiseService.java

private void addButtonToNotification(Notification n) {
    // Create a new RV with a Stop button.
    RemoteViews rv = new RemoteViews(getPackageName(), R.layout.notification_with_stop_button);
    PendingIntent pendingIntent = PendingIntent.getService(this, 0,
            newStopIntent(this, R.string.stop_reason_notification), PendingIntent.FLAG_CANCEL_CURRENT);
    rv.setOnClickPendingIntent(R.id.stop_button, pendingIntent);

    // Pre-render the original RV, and copy some of the colors.
    final View inflated = n.contentView.apply(this, new FrameLayout(this));
    final TextView titleText = findTextView(inflated, getString(R.string.app_name));
    final TextView defaultText = findTextView(inflated, getString(R.string.notification_text));
    rv.setInt(R.id.divider, "setBackgroundColor", defaultText.getTextColors().getDefaultColor());
    rv.setInt(R.id.stop_button_square, "setBackgroundColor", titleText.getTextColors().getDefaultColor());

    // Insert a copy of the original RV into the new one.
    rv.addView(R.id.notification_insert, n.contentView.clone());

    // Splice everything back into the original's root view.
    int id = Resources.getSystem().getIdentifier("status_bar_latest_event_content", "id", "android");
    n.contentView.removeAllViews(id);/*w ww  . j a  v  a2 s. c om*/
    n.contentView.addView(id, rv);
}

From source file:net.hyx.app.volumenotification.factory.NotificationFactory.java

private RemoteViews getCustomContentView() {
    RemoteViews view = new RemoteViews(_package, R.layout.view_layout_notification);
    int style = settings.getResources().getIdentifier("style_" + settings.getTheme(), "style", _package);
    int backgroundColor;
    int iconColor;

    if (style != 0) {
        backgroundColor = settings.getStyleAttributeColor(style, android.R.attr.colorBackground);
        iconColor = settings.getStyleAttributeColor(style, android.R.attr.colorForeground);
    } else {// w  w  w  .  j  a va2  s .c  o m
        backgroundColor = settings.getColor(settings.getCustomThemeBackgroundColor());
        iconColor = settings.getColor(settings.getCustomThemeIconColor());
    }
    if (settings.getTranslucent()) {
        backgroundColor = android.R.color.transparent;
    }
    view.setInt(R.id.notification_layout, "setBackgroundColor", backgroundColor);
    view.removeAllViews(R.id.volume_control_wrapper);

    for (int pos = 0; pos < items.size(); pos++) {
        VolumeControl item = model.parseItem(items.get(pos));
        if (item.status == 0) {
            continue;
        }
        RemoteViews btn = new RemoteViews(_package, R.layout.view_widget_volume_control);
        PendingIntent event = PendingIntent.getBroadcast(context.getApplicationContext(), item.id,
                new Intent(context, SetVolumeReceiver.class).putExtra(EXTRA_ITEM_ID, item.id),
                PendingIntent.FLAG_UPDATE_CURRENT);

        btn.setOnClickPendingIntent(R.id.btn_volume_control, event);
        btn.setInt(R.id.btn_volume_control, "setImageResource", model.getIconDrawable(item.icon));
        btn.setInt(R.id.btn_volume_control, "setColorFilter", iconColor);
        view.addView(R.id.volume_control_wrapper, btn);
    }

    return view;
}

From source file:net.hyx.app.volumenotification.NotificationFactory.java

private RemoteViews getCustomContentView() {

    RemoteViews view = new RemoteViews(_package, R.layout.view_layout_notification);
    List<Integer> buttons = new ArrayList<>();
    int theme = resources.getIdentifier("style_" + settings.getTheme(), "style", _package);
    int background_color;
    int icon_color;

    if (theme != 0) {
        TypedArray attrs = context.obtainStyledAttributes(theme, R.styleable.styleable);
        background_color = attrs.getColor(R.styleable.styleable_background_color, 0);
        icon_color = attrs.getColor(R.styleable.styleable_icon_color, 0);
        attrs.recycle();//from w  w  w .ja va2s.  c o  m
    } else {
        background_color = settings.getColor(settings.getCustomThemeBackgroundColor());
        icon_color = settings.getColor(settings.getCustomThemeIconColor());
    }
    if (settings.getTransparent()) {
        background_color = android.R.color.transparent;
    }
    view.setInt(R.id.layout_background, "setBackgroundColor", background_color);
    view.removeAllViews(R.id.layout_buttons);

    for (int pos = 1; pos <= BUTTONS_SELECTION_SIZE; pos++) {
        int sel = settings.getButtonSelection(pos);
        if (!settings.getButtonChecked(pos) || buttons.contains(sel) || sel >= BUTTONS_SELECTION_SIZE) {
            continue;
        }
        buttons.add(sel);
        int btn_sel = sel + 1;
        int btn_id = resources.getIdentifier("btn_sel_" + btn_sel, "id", _package);
        RemoteViews btn = new RemoteViews(_package,
                resources.getIdentifier("view_btn_sel_" + btn_sel, "layout", _package));
        Intent intent = new Intent(context, ReceiverSetVolume.class).putExtra("position", pos);
        PendingIntent event = PendingIntent.getBroadcast(context, btn_id, intent,
                PendingIntent.FLAG_UPDATE_CURRENT);

        btn.setOnClickPendingIntent(btn_id, event);
        //btn.setInt(btn_id, "setImageResource", settings.getDrawable(context, R.array.pref_buttons_icons_entries, settings.getButtonIcon(pos)));
        btn.setInt(btn_id, "setColorFilter", icon_color);
        view.addView(R.id.layout_buttons, btn);
    }
    return view;
}

From source file:eu.trentorise.smartcampus.widget.shortcuts.StackWidgetService.java

@Override
public RemoteViews getViewAt(int position) {
    // position will always range from 0 to getCount() - 1.

    // We construct a remote views item based on our widget item xml
    // file, and set the
    // text based on the position.
    RemoteViews rv = new RemoteViews(mContext.getPackageName(), R.layout.widget_item);
    ShapeDrawable sd1 = new ShapeDrawable(new RectShape());
    sd1.getPaint().setColor(0xFFFFFFFF);
    sd1.getPaint().setStyle(Style.STROKE);
    sd1.getPaint().setStrokeWidth(1);/*from w w  w. j av a  2s  .  c o m*/
    Canvas c = new Canvas();
    sd1.draw(c);
    Bitmap b = Bitmap.createBitmap(120, 120, Bitmap.Config.ARGB_8888);
    c.drawBitmap(b, 0, 0, sd1.getPaint());
    // Next, we set a fill-intent which will be used to fill-in the
    // pending intent template
    // which is set on the collection view in StackWidgetProvider.

    if (ALLPREFERENCES != null && ALLPREFERENCES[position] != null) { //ALLPREFERENCES  dimensionato come le preferenze selezionate

        BookmarkDescriptor myDescriptor = ALLPREFERENCES[position];

        // set the widgetbutton
        if (WidgetHelper.PARAM_TYPE.equals(myDescriptor.params.get(0).name)) { //controllare con gli input da config activity?
            String type = myDescriptor.params.get(0).value;
            if (WidgetHelper.TYPE_DT.equals(type)) {
                // dt -> put icons and hide text
                rv.setViewVisibility(R.id.text_widget_item, View.GONE);
                rv.setImageViewResource(R.id.image_widget_item,
                        Integer.parseInt(myDescriptor.params.get(2).value));

                rv.setInt(R.id.image_widget_item, "setBackgroundResource", R.drawable.rounded_border_dt);

            } else if (WidgetHelper.TYPE_JP.equals(type)) {
                // jp -> put text and hide icon

                rv.setViewVisibility(R.id.image_widget_item, View.GONE);
                // rv.setImageViewBitmap(R.id.text_widget_item,
                // getBackground(Color.parseColor("#6EB046")));
                if (!("0".equals(myDescriptor.params.get(2).value))) {
                    //bus
                    rv.setTextViewTextSize(R.id.text_widget_item, TypedValue.COMPLEX_UNIT_DIP, 80);

                    rv.setTextViewText(R.id.text_widget_item, RoutesHelper.getShortNameByRouteIdAndAgencyID(
                            myDescriptor.params.get(4).value, myDescriptor.params.get(3).value)); //4,3
                    rv.setTextColor(R.id.text_widget_item, Integer.parseInt(myDescriptor.params.get(2).value));//rv.setInt(R.id.text_widget_item, "setBackgroundColor",
                    //Integer.parseInt(myDescriptor.params.get(2).value));
                    rv.setInt(R.id.text_widget_item, "setBackgroundResource", R.drawable.rounded_border_jp);

                } else {
                    //train
                    rv.setTextViewTextSize(R.id.text_widget_item, TypedValue.COMPLEX_UNIT_DIP, 12);
                    //controllo contesto getRouteDescriptor i vari parametri
                    rv.setTextViewText(R.id.text_widget_item,
                            mContext.getString(
                                    RoutesHelper.getRouteDescriptorByRouteId(myDescriptor.params.get(3).value,
                                            myDescriptor.params.get(4).value).getNameResource()));
                    rv.setTextColor(R.id.text_widget_item, Color.BLACK);//Int(R.id.text_widget_item, "setBackgroundColor",Color.BLACK);
                    rv.setInt(R.id.text_widget_item, "setBackgroundResource", R.drawable.rounded_border_jp);

                }

            } else if (WidgetHelper.TYPE_JP_PARKINGS.equals(type)) {
                // jp parcheggio -> put text and hide icon
                rv.setViewVisibility(R.id.text_widget_item, View.GONE);
                rv.setImageViewResource(R.id.image_widget_item,
                        Integer.parseInt(myDescriptor.params.get(2).value));
                rv.setInt(R.id.image_widget_item, "setBackgroundResource", R.drawable.rounded_border_jp);

            }
            BookmarkDescriptor bookmark = myDescriptor;
            Bundle extras = new Bundle();
            extras.putString(StackWidgetProvider.EXTRA_INTENT, bookmark.getIntent());
            if (bookmark.getParams() != null) {
                for (Param param : bookmark.getParams()) {
                    extras.putString(param.name, param.value);

                }

            }
            Intent fillInIntent = new Intent(bookmark.getIntent());
            fillInIntent.putExtras(extras);
            rv.setOnClickFillInIntent(R.id.layout, fillInIntent);
        }

    }
    // Return the remote views object.
    // AppWidgetManager manager = AppWidgetManager.getInstance(mContext);
    // manager.updateAppWidget(thisWidget, rv);
    return rv;
}

From source file:android.app.Notification.java

/**
 * Sets the {@link #contentView} field to be a view with the standard "Latest Event"
 * layout.// w  w  w.j  a v a 2 s .  co m
 *
 * <p>Uses the {@link #icon} and {@link #when} fields to set the icon and time fields
 * in the view.</p>
 * @param context       The context for your application / activity.
 * @param contentTitle The title that goes in the expanded entry.
 * @param contentText  The text that goes in the expanded entry.
 * @param contentIntent The intent to launch when the user clicks the expanded notification.
 * If this is an activity, it must include the
 * {@link android.content.Intent#FLAG_ACTIVITY_NEW_TASK} flag, which requires
 * that you take care of task management as described in the
 * <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back
 * Stack</a> document.
 *
 * @deprecated Use {@link Builder} instead.
 */
@Deprecated
public void setLatestEventInfo(Context context, CharSequence contentTitle, CharSequence contentText,
        PendingIntent contentIntent) {
    // TODO: rewrite this to use Builder
    RemoteViews contentView = new RemoteViews(context.getPackageName(), R.layout.notification_template_base);
    if (this.icon != 0) {
        contentView.setImageViewResource(R.id.icon, this.icon);
    }
    if (priority < PRIORITY_LOW) {
        contentView.setInt(R.id.icon, "setBackgroundResource", R.drawable.notification_template_icon_low_bg);
        contentView.setInt(R.id.status_bar_latest_event_content, "setBackgroundResource",
                R.drawable.notification_bg_low);
    }
    if (contentTitle != null) {
        contentView.setTextViewText(R.id.title, contentTitle);
    }
    if (contentText != null) {
        contentView.setTextViewText(R.id.text, contentText);
    }
    if (this.when != 0) {
        contentView.setViewVisibility(R.id.time, View.VISIBLE);
        contentView.setLong(R.id.time, "setTime", when);
    }
    if (this.number != 0) {
        NumberFormat f = NumberFormat.getIntegerInstance();
        contentView.setTextViewText(R.id.info, f.format(this.number));
    }

    this.contentView = contentView;
    this.contentIntent = contentIntent;
}

From source file:com.rks.musicx.services.NotificationHandler.java

public static void buildNotification(MusicXService musicXService, String what) {
    if (musicXService == null) {
        return;//  w w  w  . ja va2  s .  c  om
    }
    RemoteViews remoteViews = new RemoteViews(musicXService.getPackageName(), R.layout.widget);
    RemoteViews smallremoteView = new RemoteViews(musicXService.getPackageName(), R.layout.small_notification);

    Intent intent = new Intent(musicXService, PlayingActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent pendInt = PendingIntent.getActivity(musicXService, 0, intent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    NotificationCompat.Builder builder = (NotificationCompat.Builder) new NotificationCompat.Builder(
            musicXService).setWhen(System.currentTimeMillis()).setCategory(Intent.CATEGORY_APP_MUSIC)
                    .setPriority(Notification.PRIORITY_DEFAULT).setShowWhen(false).setAutoCancel(true)
                    .setCustomBigContentView(remoteViews).setContent(smallremoteView)
                    .setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
    remoteViews.setOnClickPendingIntent(R.id.item_view, pendInt);
    smallremoteView.setOnClickPendingIntent(R.id.small_item_view, pendInt);
    remoteViews.setTextViewText(R.id.title, musicXService.getsongTitle());
    remoteViews.setTextViewText(R.id.artist, musicXService.getsongArtistName());
    smallremoteView.setTextViewText(R.id.small_title, musicXService.getsongTitle());
    smallremoteView.setTextViewText(R.id.small_artist, musicXService.getsongArtistName());
    FavHelper favHelper = new FavHelper(musicXService);
    if (favHelper.isFavorite(musicXService.getsongId())) {
        remoteViews.setImageViewResource(R.id.action_favorite, R.drawable.ic_action_favorite);
    } else {
        remoteViews.setImageViewResource(R.id.action_favorite, R.drawable.ic_action_favorite_outline);
    }
    if (musicXService.isPlaying()) {
        builder.setSmallIcon(R.drawable.aw_ic_play);
        builder.setOngoing(true);
    } else {
        builder.setSmallIcon(R.drawable.aw_ic_pause);
        builder.setOngoing(false);
    }
    if (what.equals(PLAYSTATE_CHANGED)) {
        if (MediaPlayerSingleton.getInstance().getMediaPlayer().isPlaying()) {
            remoteViews.setImageViewResource(R.id.toggle, R.drawable.aw_ic_play);
            smallremoteView.setImageViewResource(R.id.small_toggle, R.drawable.aw_ic_play);
        } else {
            remoteViews.setImageViewResource(R.id.toggle, R.drawable.aw_ic_pause);
            smallremoteView.setImageViewResource(R.id.small_toggle, R.drawable.aw_ic_pause);
        }
    }
    handler.post(new Runnable() {
        @Override
        public void run() {
            ArtworkUtils.ArtworkLoader(musicXService, 300, 300, musicXService.getsongAlbumName(),
                    musicXService.getsongAlbumID(), new palette() {
                        @Override
                        public void palettework(Palette palette) {
                            int colors[] = Helper.getAvailableColor(musicXService, palette);
                            remoteViews.setInt(R.id.item_view, "setBackgroundColor", colors[0]);
                            remoteViews.setInt(R.id.title, "setTextColor", Color.WHITE);
                            remoteViews.setInt(R.id.artist, "setTextColor", Color.WHITE);
                            smallremoteView.setInt(R.id.small_item_view, "setBackgroundColor", colors[0]);
                            smallremoteView.setInt(R.id.small_title, "setTextColor", Color.WHITE);
                            smallremoteView.setInt(R.id.small_artist, "setTextColor", Color.WHITE);
                        }
                    }, new bitmap() {
                        @Override
                        public void bitmapwork(Bitmap bitmap) {
                            remoteViews.setImageViewBitmap(R.id.artwork, bitmap);
                            smallremoteView.setImageViewBitmap(R.id.small_artwork, bitmap);
                            NotificationManagerCompat.from(musicXService).notify(notificationID,
                                    builder.build());
                        }

                        @Override
                        public void bitmapfailed(Bitmap bitmap) {
                            remoteViews.setImageViewBitmap(R.id.artwork, bitmap);
                            smallremoteView.setImageViewBitmap(R.id.small_artwork, bitmap);
                            NotificationManagerCompat.from(musicXService).notify(notificationID,
                                    builder.build());
                        }
                    });
        }
    });
    controls(remoteViews, smallremoteView, musicXService);
}

From source file:au.com.wallaceit.reddinator.Rservice.java

@Override
public RemoteViews getViewAt(int position) {
    RemoteViews row;
    if (position > data.length()) {
        return null; //  prevent errornous views
    }// w  ww . ja  v a2s.  com
    // check if its the last view and return loading view instead of normal row
    if (position == data.length()) {
        // build load more item
        //System.out.println("load more getViewAt("+position+") firing");
        RemoteViews loadmorerow = new RemoteViews(mContext.getPackageName(), R.layout.listrowloadmore);
        if (endOfFeed) {
            loadmorerow.setTextViewText(R.id.loadmoretxt, "There's nothing more here");
        } else {
            loadmorerow.setTextViewText(R.id.loadmoretxt, "Load more...");
        }
        loadmorerow.setTextColor(R.id.loadmoretxt, themeColors[0]);
        Intent i = new Intent();
        Bundle extras = new Bundle();
        extras.putString(WidgetProvider.ITEM_ID, "0"); // zero will be an indicator in the onreceive function of widget provider if its not present it forces a reload
        i.putExtras(extras);
        loadmorerow.setOnClickFillInIntent(R.id.listrowloadmore, i);
        return loadmorerow;
    } else {
        // build normal item
        String title = "";
        String url = "";
        String permalink = "";
        String thumbnail = "";
        String domain = "";
        String id = "";
        int score = 0;
        int numcomments = 0;
        boolean nsfw = false;
        try {
            JSONObject tempobj = data.getJSONObject(position).getJSONObject("data");
            title = tempobj.getString("title");
            //userlikes = tempobj.getString("likes");
            domain = tempobj.getString("domain");
            id = tempobj.getString("name");
            url = tempobj.getString("url");
            permalink = tempobj.getString("permalink");
            thumbnail = (String) tempobj.get("thumbnail"); // we have to call get and cast cause its not in quotes
            score = tempobj.getInt("score");
            numcomments = tempobj.getInt("num_comments");
            nsfw = tempobj.getBoolean("over_18");
        } catch (JSONException e) {
            e.printStackTrace();
            // return null; // The view is invalid;
        }
        // create remote view from specified layout
        if (bigThumbs) {
            row = new RemoteViews(mContext.getPackageName(), R.layout.listrowbigthumb);
        } else {
            row = new RemoteViews(mContext.getPackageName(), R.layout.listrow);
        }
        // build view
        row.setTextViewText(R.id.listheading, Html.fromHtml(title).toString());
        row.setFloat(R.id.listheading, "setTextSize", Integer.valueOf(titleFontSize)); // use for compatibility setTextViewTextSize only introduced in API 16
        row.setTextColor(R.id.listheading, themeColors[0]);
        row.setTextViewText(R.id.sourcetxt, domain);
        row.setTextColor(R.id.sourcetxt, themeColors[3]);
        row.setTextColor(R.id.votestxt, themeColors[4]);
        row.setTextColor(R.id.commentstxt, themeColors[4]);
        row.setTextViewText(R.id.votestxt, String.valueOf(score));
        row.setTextViewText(R.id.commentstxt, String.valueOf(numcomments));
        row.setInt(R.id.listdivider, "setBackgroundColor", themeColors[2]);
        row.setViewVisibility(R.id.nsfwflag, nsfw ? TextView.VISIBLE : TextView.GONE);
        // add extras and set click intent
        Intent i = new Intent();
        Bundle extras = new Bundle();
        extras.putString(WidgetProvider.ITEM_ID, id);
        extras.putInt("itemposition", position);
        extras.putString(WidgetProvider.ITEM_URL, url);
        extras.putString(WidgetProvider.ITEM_PERMALINK, permalink);
        i.putExtras(extras);
        row.setOnClickFillInIntent(R.id.listrow, i);
        // load thumbnail if they are enabled for this widget
        if (loadThumbnails) {
            // load big image if preference is set
            if (!thumbnail.equals("")) { // check for thumbnail; self is used to display the thinking logo on the reddit site, we'll just show nothing for now
                if (thumbnail.equals("nsfw") || thumbnail.equals("self") || thumbnail.equals("default")) {
                    int resource = 0;
                    switch (thumbnail) {
                    case "nsfw":
                        resource = R.drawable.nsfw;
                        break;
                    case "default":
                    case "self":
                        resource = R.drawable.self_default;
                        break;
                    }
                    row.setImageViewResource(R.id.thumbnail, resource);
                    row.setViewVisibility(R.id.thumbnail, View.VISIBLE);
                    //System.out.println("Loading default image: "+thumbnail);
                } else {
                    Bitmap bitmap;
                    String fileurl = mContext.getCacheDir() + "/thumbcache-" + appWidgetId + "/" + id + ".png";
                    // check if the image is in cache
                    if (new File(fileurl).exists()) {
                        bitmap = BitmapFactory.decodeFile(fileurl);
                        saveImageToStorage(bitmap, id);
                    } else {
                        // download the image
                        bitmap = loadImage(thumbnail);
                    }
                    if (bitmap != null) {
                        row.setImageViewBitmap(R.id.thumbnail, bitmap);
                        row.setViewVisibility(R.id.thumbnail, View.VISIBLE);
                    } else {
                        // row.setImageViewResource(R.id.thumbnail, android.R.drawable.stat_notify_error); for later
                        row.setViewVisibility(R.id.thumbnail, View.GONE);
                    }
                }
            } else {
                row.setViewVisibility(R.id.thumbnail, View.GONE);
            }
        } else {
            row.setViewVisibility(R.id.thumbnail, View.GONE);
        }
        // hide info bar if options set
        if (hideInf) {
            row.setViewVisibility(R.id.infbox, View.GONE);
        } else {
            row.setViewVisibility(R.id.infbox, View.VISIBLE);
        }
    }
    //System.out.println("getViewAt("+position+");");
    return row;
}