INQ241B
Mobile Apps

Activity 13

Create Stock Price App

In this activity you will create an app that can display current stock prices by accessing data on the web.

Details

Use App Inventor to create an app that displays current stock prices. The app should have the following components:

  1. A TextBox component and a Button componenet, grouped together with a horizontal arrangement. The text box should be empty and the button text should be "Get Stock Price".

  2. A Label component that initially has no text.

  3. A Web component with the default properties.

The app should have blocks that do the following:

  1. When the user clicks the button, the app should get the web page that contains the current stock price for the ticker symbol in the text box. Set the Web component's Url property to the text:

    http://search.yahoo.com/search?p=XXXX

    The text XXXX in the URL should be replaced with the ticker symbol in the text box. Finally, call the Web component's Get function.

  2. The Web component’s Get function does not return information immediately. Instead, it generates an event when the retrieval is complete. So to display the stock information, add a Web component GotText event handler. Inside the event handler set the label’s Text property to the responseContent parameter.

  3. The responseContent contains the source code for the entire web page, it should only contain the stock's price. Parse the responseContent so that the label only displays the stock price. Use the split at first block and the select list item blocks to split the response content into two pieces and select only the peice that contains the stock price.