Part 0 - Setting Up
Part 1 - Fundamentals
- 4 - Our Project
- 5 - Fragment and ViewModel
- 6 - Functions
- 7 - Recycler Views
- 8 - Wiring up with Kotlin
- 9 - ViewHolders
- 10 - Retrofit
- 11 - Connecting Rx
Part 2 - User Interface
Useful Links
Step 4 - Our Project
OK - time to get our hands dirty with a real project!
We’ll be building a super-basic Twitter client that just fetches one author’s tweets from the Twitter API.

AndroidTweetGettr
This programming assignment will go in 3 stages: if you don’t get through them all in the face-to-face part of the course please continue in your own time. We’ll break them down so you can have a running app as we move forward.
The app is called:
- AndroidTweetGettr
Your new client wants an app that just fetches tweets when ever they run it from their favourite tweeter, @GretaThunberg.
The app will have your clients Twitter API key pasted into it for the MVP version, later you can have this configurable.
The app is based on a Swift project called SwiftTweetGettr which has been ported into C++ and other languages as well. The project handily lays out the service API calls you’ll need to make.
We’ll be using Retrofit to handle the API calls.
App Design

Here’s the steps we’ll follow for our project:
-
- Build the UI
- An
Activitywill host aFragment
- Codelab on Fragments
* That in turn will have a
RecyclerViewlisting the tweets * At first we’ll have dummy data * The dummy data will be hosted inaViewModel* It will be aLiveData<List<TweetItem>>
- An
- Build the UI
-
- Create the Twitter data source
- We’ll create a
Retrofitservice to fetch
- the API token
- and data
* We’ll hook up to a
TweetRepository - This will have a
getTweetsmethod - The
getTweetswill return a single which… - …will push data into the view models livedata * Twitter images will be fetched
- using the getImage method from SwiftTweetGettr.
- We’ll create a
- Create the Twitter data source
-
- Cache the data into a
Roomdatabase- When the app loads it can fetch Greta tweets from an on device store
- No more being starved of Greta tweets when network is unavailable
- If network is available we’ll fetch updated tweets and store them
- Cache the data into a