Chapter 5. You've Got to Know When to Hold 'em
This chapter will take us through the development of a Stock Portfolio mobile application. It will allow users to organize their stocks as well as their respective quantities. From there, users will be able to define an amount of money they want to earn through their investments. The application will then allow on-demand retrieval of the latest stock prices from the Internet and then calculate the total portfolio's value. The application will then display how far (or close) the user is from his/her objective. When the portfolio's total value reaches the objective, the application will recommend selling the stocks.
This new application is different in terms of navigation, since it has two windows. The main window will show the investment progression using a progress bar component as well as labels and buttons for interaction. The second window will show all the stocks from the portfolio, as well as text fields to allow the users to change some settings. The stock prices will be retrieved using HTTP calls. Settings, and the portfolio itself will be persisted on the device using Titanium's properties functionality.
In this chapter, we will cover the following concepts:
- Navigating back and forth between different windows
- Using the progress bar component
- Retrieving online information using HTTP
- Creating different layers for different parts of the application (model, services, and UI)
- Setting a default UI unit for the entire project
- Creating forms using text fields and labels
- Creating custom table view rows
- Using global events