Click here to Skip to main content
6,595,854 members and growing! (17,510 online)
Email Password   helpLost your password?
Platforms, Frameworks & Libraries » Mobile Development » Applications     Intermediate License: The Code Project Open License (CPOL)

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

By MiamiCoder

End-to-end real world BlackBerry application walkthrough, Part 2.
Java, C# 2.0, Java, Mobile (Blackberry), .NET 2.0VS2005, Architect, Dev, Design
Posted:25 Jun 2008
Updated:15 Jul 2008
Views:11,308
Bookmarked:14 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
3 votes for this article.
Popularity: 1.75 Rating: 3.67 out of 5
1 vote, 33.3%
1

2

3

4
2 votes, 66.7%
5

Introduction

In the first article of this series, I started walking you through the creation of an end-to-end BlackBerry application that will serve as a mobile front-end to my Knowledge Base sample web application.

The requirements for the mobile application are pretty simple:

  1. Searching a collection of articles stored in a knowledge base repository, by title or tags.
  2. View an article. The article’s visible attributes are: title, body, tags, author’s name, date published.

And, my building blocks look like this:

Building-Blocks1.gif

Implementation

Previously, I finished the Application class and the Home Screen.

Home-Screen1.gif

I will continue now with the rest of the screens.

Tags Screen

The Tags Screen displays a list of the existing tags in the database. Beside each tag, there will be a count of the articles the tag applies to.

Tags-Screen1.gif

Search Screen

This screen will allow our users to initiate an articles search by typing one or more words belonging to the article’s title.

Search-Screen1.gif

The searchArticles() function is present in both the Tags Screen and the Search Screen, and so far, it only pushes the Articles Screen to the top of the stack. Later, I will add the code that will request my server-side handler to issue the database query and return any results.

private void searchArticles() {
    String searchPhrase = searchPhraseField.getText().trim();
    if (null != searchPhrase && searchPhrase.length() > 0) {
        UiApplication.getUiApplication().pushScreen(articlesScreen);
        // TODO: Trigger the search function in the Articles Screen. 
    } else {
        Dialog.alert("You must enter a search phrase.");
    }
}

Articles Screen

The Articles Screen shows a list of articles that satisfy the criteria entered on the Search Screen. It can also show a list of recently viewed articles. Clicking on any listed article will bring the Article Screen to the top of the stack.

Articles-Screen1.gif

Since I’m still missing the network routines, I created a few dummy articles in order to test the look and feel of the Articles Screen:

ArticlesScreen() {
        
    this.setTitle("Articles");

    // Create a few dummy tags in order to test the screen;
    articles = new Article[15];
    Article article;
    for (int i = 0; i < 15; i++) {
        article = new Article();
        article.title = "Dummy article " + Integer.toString(i);
        article.author = "ramonj";
        article.contents = "This is a test article";
        article.tags = new String[] {"tag 1", "tag 2", "tag 3"};
        article.dateCreated = "01/01/2008";
        articles[i] = article;
    }
    
    articlesList = new ArticlesListField();
    articlesList.set(articles);
    this.add(articlesList);
}

The Article class is shown below. Note that I’m not paying a lot of attention to encapsulation, since the usage of this class will be restricted to only a few places in the application.

class Article {
    public String title;
    public String dateCreated;  
    public String author;
    public String[] tags;
    public String contents;
}

Article Screen

The Article Screen shows the viewable attributes of the article that was selected on the Articles Screen. This is where the user gets to read the article. This is another place where I use the Article class shown above.

Article-Screen1.gif

Options Screen

Finally, the Options Screen allows the user to change the application settings. In terms of settings, so far, I can only think of the URL our application will connect to in order to talk to its server counterpart, and the number of references to recently viewed articles to keep cached on the device.

Options-Screen1.gif

What’s Next

In the next article of this series, I will add the networking code as well as the code to save and retrieve the application settings. After this, I will move to the server side and take care of the pieces that will handle the communications with the device.

History

License

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

About the Author

MiamiCoder


Member
I run a small development team for an international Law Firm.
Occupation: Team Leader
Location: United States United States

Other popular Mobile Development articles:

  • Writing Your Own GPS Applications: Part 2
    In part two of the series, the author of "GPS.NET" teaches developers how to write GPS applications suitable for the real world by mastering GPS precision concepts. Source code includes a working NMEA interpreter and sample high-precision application in C# and VB.NET.
  • Writing Your Own GPS Applications: Part I
    What is it that GPS applications need to be good enough to use for in-car navigation? Also, how does the process of interpreting GPS data actually work? In this three-part series, I will cover both topics and give you the skills you need to write a commercial-grade GPS application.
  • Learn How to Find GPS Location on Any SmartPhone, and Then Make it Relevant
    A step by step tutorial for getting GPS from any SmartPhone, even without GPS built in, and then making location useful.
  • iPhone UI in Windows Mobile
    It's an interface that works with transparency effects. As a sample I used an interface just like the iPhone one. In this tutorial I am explaining how simple is working with transparency on Windows Mobile.
  • Pocket 1945 - A C# .NET CF Shooter
    An article on Pocket PC game development
Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 1 of 1 (Total in Forum: 1) (Refresh)FirstPrevNext
GeneralMy vote of 1 Pinmemberersab3:48 3 May '09  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 15 Jul 2008
Editor: Smitha Vijayan
Copyright 2008 by MiamiCoder
Everything else Copyright © CodeProject, 1999-2009
Web18 | Advertise on the Code Project