How did you set the downloaded image value?
--To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/8051a9ed-1a03-4672-89aa-64e083bcba66%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/ostXxPKQzRU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
Which conditions be checked to remove frequently calling?
Get item at is invoked VERY frequently, its not a problem you need to code with that in mind.
The duplicate entry will happen if all URL's are the same.
--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/ostXxPKQzRU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/9390ba40-814f-4c11-b4d2-da43be26fb08%40googlegroups.com.
I am using following listModel
public class ListModel1 implements ListModel {
private int selected;
private EventDispatcher selectionListeners = new EventDispatcher();
private int no;
private ArrayList<ItemModel> itemModels;
List list;
public ListModel1(ArrayList<ItemModel> itemModels, List list) {
this.list = list;
this.no = itemModels.size();
this.itemModels = itemModels;
}
public Object getItemAt(int index) {
Resources res = Resources.openLayered("/theme");
Image image = res.getImage("setting.png");
ItemModel itemModel = itemModels.get(index);
String name = new ImageUrl().getImageName(itemModel.getImageUrl());
boolean isImageFound = Storage.getInstance().exists(name);
entry.put("id", "" + itemModel.getId());
entry.put("iconk_URLImage", itemModel.getImageUrl());
return entry;
}
public int getSize() {
return no;
}
public int getSelectedIndex() {
return selected;
}
public void setSelectedIndex(int index) {
if (this.selected != index) {
int oldSelected = this.selected;
this.selected = index;
selectionListeners.fireSelectionEvent(oldSelected, selected);
}
}
public void addDataChangedListener(DataChangedListener l) {
// useful if we change the content of the list
}
public void removeDataChangedListener(DataChangedListener l) {
}
public void addSelectionListener(SelectionListener l) {
selectionListeners.addListener(l);
Log.p(" add selection listner ");
}
public void removeSelectionListener(SelectionListener l) {
selectionListeners.removeListener(l);
}
public void addItem(Object item) {
}
public void removeItem(int index) {
}
}
I am using following listModel
public class ListModel1 implements ListModel {
private int selected;
private EventDispatcher selectionListeners = new EventDispatcher();
private int no;
private ArrayList<ItemModel> itemModels;
List list;
public ListModel1(ArrayList<ItemModel> itemModels, List list) {
this.list = list;
this.no = itemModels.size();
this.itemModels = itemModels;
}
public Object getItemAt(int index) {
Resources res = Resources.openLayered("/theme");
Image image = res.getImage("setting.png");
I am using following listModel
public class ListModel1 implements ListModel {
private int selected;
private EventDispatcher selectionListeners = new EventDispatcher();
private int no;
private ArrayList<ItemModel> itemModels;
List list;
public ListModel1(ArrayList<ItemModel> itemModels, List list) {
this.list = list;
this.no = itemModels.size();
this.itemModels = itemModels;
}
public Object getItemAt(int index) {
Resources res = Resources.openLayered("/theme");
Image image = res.getImage("setting.png");
I am using attached listmodel and rendererContainter in project .
1. getItemAt method is called repeatedly
2.and the online image is not still displayed ?
how to display online image and to handle getItemAt method call ?
I am only passing id and iconk_URLImage for testing loading image in label using following codes
Hashtable entry = new Hashtable();
ItemModel itemModel = itemModels.get(index);
entry.put("id", "" + itemModel.getId()); entry.put("iconk_URLImage", itemModel.getImageUrl());
I am using following listModel
public class ListModel1 implements ListModel {
private int selected;
private EventDispatcher selectionListeners = new EventDispatcher();
private int no;
private ArrayList<ItemModel> itemModels;
List list;
public ListModel1(ArrayList<ItemModel> itemModels, List list) {
this.list = list;
this.no = itemModels.size();
this.itemModels = itemModels;
}
public Object getItemAt(int index) {
Resources res = Resources.openLayered("/theme");
Image image = res.getImage("setting.png");
ItemModel itemModel = itemModels.get(index);
String name = new ImageUrl().getImageName(itemModel.getImageUrl());
boolean isImageFound = Storage.getInstance().exists(name);
entry.put("id", "" + itemModel.getId());
entry.put("iconk_URLImage", itemModel.getImageUrl());
I don't understand what sort of "clue" you need for something that is a fact that you can't change. Renderer will be invoke a lot since it needs to animate elements into place.
--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/ostXxPKQzRU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/ec495083-de26-433f-877e-9074fdbc5f0c%40googlegroups.com.
while (c.next())
{
hlist = new Hashtable();
r = c.getRow();
sb.delete(0, sb.length());
sb.append("alb").append(r.getInteger(4));
urlcover = r.getString(10);
hlist.put("Line1", r.getString(6));
hlist.put("Line2", r.getString(8));
hlist.put("icon", defaultimg);
hlist.put("iconName", sb.toString());
hlist.put("icon_URLImage", urlcover);
vlist.add(hlist);
}
mlist.setModel(new Model(vlist));
mlist.setRenderer(createListRenderer());
In createListRenderer my code is :
private static MultiButton createRendererMultiButton() {
MultiButton b = new MultiButton();
b.setIconName("icon");
b.setNameLine1("Line1");
b.setNameLine2("Line2");
b.setUIID("Label");
return b;
}
private static ListCellRenderer createListRenderer() {
MultiButton sel = createRendererMultiButton();
MultiButton unsel = createRendererMultiButton();
return new GenericListCellRenderer(sel, unsel);
}
--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/ostXxPKQzRU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/6d62ecb2-1727-4942-bd63-dd07a715713b%40googlegroups.com.