Click here to Skip to main content
15,895,011 members
Articles / Mobile Apps / Blackberry

End-to-End Real World BlackBerry Application, Part 2

Rate me:
Please Sign up or sign in to vote.
3.67/5 (3 votes)
15 Jul 2008CPOL2 min read 31.8K   186   19  
End-to-end real world BlackBerry application walkthrough, Part 2.
package KnowledgeBase;

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.system.Bitmap;

class ArticleScreen extends MainScreen {
    
    private LabelField titleLabel;
    private LabelField authorLabel;
    private LabelField dateLabel;
    private LabelField tagsLabel;
    private LabelField contentsLabel;
    
    ArticleScreen() {    
        
        titleLabel = new LabelField();
        authorLabel = new LabelField();
        dateLabel = new LabelField();
        tagsLabel = new LabelField();
        contentsLabel = new LabelField();
        
        this.add(titleLabel);
        this.add(new SeparatorField());
        this.add(authorLabel);
        this.add(dateLabel);
        this.add(tagsLabel);
        this.add(new SeparatorField());
        this.add(contentsLabel);
        
    }
    
    public void showArticle(Article article) {
        titleLabel.setText(article.title);
        authorLabel.setText("Author: " + article.author);
        dateLabel.setText("Created: " + article.dateCreated);
        String tags = "Tags: ";
        for (int i = 0; i < article.tags.length - 1; i++) {
            tags += article.tags[i] + ", ";
        }
        tags += article.tags[article.tags.length - 1];
        tagsLabel.setText(tags);
        contentsLabel.setText(article.contents);
    }
} 

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader
United States United States
I run a small development team for an international Law Firm.

Comments and Discussions