Search code examples
multithreadingblackberryauto-updatelistfield

Blackberry - Making auto-update news content with ListField


I try to make an auto-update feature with my RSS reader application, so it will send request in every time set, without make any execution like click any button.

I've made a feed aggregator using list field like this:

int i=0;
while (i<vec.size()){
    row = new TableRowManager();
    prov = new LabelField(((BinNews)vec.elementAt(i)).getProv(),DrawStyle.ELLIPSIS){
        protected void paint(Graphics g) {
            g.setColor(Color.ORANGERED);
            super.paint(g);
        }
    };
    title = new LabelField(((BinNews)vec.elementAt(i)).getTitle(),DrawStyle.ELLIPSIS){
        protected void paint(Graphics g) {
            g.setColor(Color.BLUE);
            super.paint(g);
        }
    };
    desc = new LabelField(((BinNews)vec.elementAt(i)).getDesc(),DrawStyle.ELLIPSIS){
        protected void paint(Graphics g) {
            g.setColor(Color.BLACK);
            super.paint(g);
        }
    };
    date = new LabelField(((BinNews)vec.elementAt(i)).getDate(),DrawStyle.ELLIPSIS){
        protected void paint(Graphics g) {
            g.setColor(Color.ORANGERED);
            super.paint(g);
        }
    };
    link = new LabelField(((BinNews)vec.elementAt(i)).getLink(),DrawStyle.ELLIPSIS){
        protected void paint(Graphics g) {
            g.setColor(Color.BLACK);
            super.paint(g);
        }
    };
    rows.addElement(row);
    setSize(rows.size());
    row.add(prov);
    row.add(date);
    row.add(title);
    row.add(desc);
    i++;
}

Please advise what should I do to make it updated automatically. Thanks!


Solution

  • finally i can simply use:

    UiApplication.getUiApplication().invokeLater(new Runnable() {
        public void run() {
            UiApplication.getUiApplication().pushScreen(new MainList());
        }
    },120000, true);