Change projections to display KPIs in your app
We can use a different projection and the same observer pattern for displaying some KPIs. Actually that is pretty easy, as we will see in this recipe.
Getting ready
For this recipe, you need to have completed the previous one successfully.
How to do it...
We will continue working on the app from the previous recipe and we will add a new view to display the KPIs:
Open the project you have worked on in the previous recipe.
Add a new layout,
fragment_thoughts_kpi.xml
:<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:gravity="center_horizontal" android:padding="16dp" android:layout_height="match_parent"> <TextView android:id="@+id/thoughts_kpi_count" android:textSize="32sp" android:layout_margin="16dp" android:layout_width="wrap_content" ...