`Day28` - Finished Lesson7 - SleepTracker done! <h...
# 100daysofkotlin-2021
j
Day28
• Finished Lesson7 - SleepTracker done! Github • Started Lesson8 ◦ REST (representational state transfer architecture) / RESTful service - web service that offer REST architecture ▪︎ Request • Contains a _URI. (_URI can take queries). Transferred to the server using HTTP protocol. • HTTP Protocol tells the server what to do (GET/POST/PUT/DELETE) ▪︎ Response • Has formatted data (ex. json, xml) ◦ JSON Response - array containing objects [ {“name”: value, {“name”: value}, {{“name”: value, “name”: value}] ◦ Library ▪︎ App ---> (pass parameters to) ---> Library ---> (URI with query parameters, HTTP method) ---> Web Server ▪︎ Web Server ---> (response, for example in json) ---> Library ---> (kotlin objects) ---> App ▪︎ build.gradle(project) - google() for google libraries (ex. Jetpack), jcenter() for community libraries ▪︎ Network layer - API that ViewModel uses to communicate with the web service ◦ Retrofit library ▪︎ Creates network layer (Base url, Converter factory needed) • Converter factory - allows Retrofit to return the response in required format • Etc. memos ◦ Before adding a new feature, I must think how to check it. Should clarify what to display by popping up a toast, printing logs etc, and then write the codes. ◦ (recap) Sealed class - all the subclass of sealed class must be defined in this file. ◦ (recap) Navigation, its setup and basic flows. ( somehow got lost whenever the lecturer mentioned navigation so..) ◦ (recap) Lazy instantiation - created the first time it is actually used
Self-Comment
• AHHHHHHHH Really hate this outdated build issues…….. Wasted time due to some navigation/safe args issue. Cannot solve it even after wasting few..almost an hour?, so just pulled the repo from that stage.. Compromised with the navigation part, recalling that navigation is in less higher priority. (According to the senior developer who gave some advices after skimming the course syllabus). Quite frustrated, but I’ll have to control my mind.. I’ll just have to get used to these kinds of frustrating issues.
Goals Tomorrow
• More than halfway through lesson 8.
🔥 1
wt..this hat?beanie? is so cute.
👀 1
1. Navigation recap activity_main.xml - instantiate navhostfragment, nav controller
Copy code
<fragment
...
android:name="androidx.navigation.fragment.NavHostFragment"
...
app:defaultNavHost="true"
app:navGraph="@navigation/navigation" />
navigation.xml - declare start destination
Copy code
<navigation ...
app:startDestination="@id/sleep_tracker_fragment">