[Solved] LAB 2 Asynchronous Simple HTTP-Stock Monitor-Stock Monitor V2

$25

File Name: LAB_2__Asynchronous_Simple_HTTP-Stock_Monitor-Stock_Monitor_V2.zip
File Size: 584.04 KB

SKU: [Solved] LAB 2 – Asynchronous Simple HTTP-Stock Monitor-Stock Monitor V2 Category: Tag:
5/5 - (1 vote)

IMPORTANT. You must save all your work in a way that you are able to present them to teacher during the evaluation discussion. You could use for instance GIT. You also need to have working developer environment where you can run the assignments.

1. Asynchronous Simple HTTP

On previous weeks assignments we had to do a little hack to get rid of the Androids security policy. Today we are going to fix that and do things right.

We have to change our code to work asynchronously. In practice this means that we are several thing in parallel. For example, UI is fully functional at the same time when we are loading something from the network. This was not the case on previous weeks assignment. If we would have loaded large files, the UI would be totally jammed during the loading.

There are several ways to solve this problem and today we are going to use AsyncTask to solve it.

Read first AsyncTask documentation: https://developer.android.com/reference/android/os/AsyncTask

Create a new app with same style as previous Simple HTTP and use AsyncTask to load data asynchronously. Remove the StrictMode.ThreadPolicy code to make sure that your load is asynchronous.

2. Stock Monitor

Create an app which can be used as stock monitor.

First version of the app should display stock prices of following companies

Company Stock ID
Apple AAPL
Alphabet (Google) GOOGL
Facebook FB
Nokia NOK

Use this REST api to get the stock price: https://financialmodelingprep.com/api/company/price/NOK Last parameter in the path will be the stock ID.

Api returns the result in JSON format. You can test it in browser to see the format. We havent yet studied elegant ways to parse JSON, we will do it next week. Today you can do JSON parsing (get the price out of the json) with Javas String methods indexOf and subString. Of course, you can use more elegant json parsers if you wish.

Heres the example of the UI.

3. Stock Monitor V2

Create a copy of the previous stock monitor app. Modify it in a way that you can add more stocks to the app. See the example below.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] LAB 2 Asynchronous Simple HTTP-Stock Monitor-Stock Monitor V2
$25