2024-01-01から1年間の記事一覧
This is my note for Udemy lesson: Advanced Android Bootcamp 2024. 1. Add Recycler View Create a new project and drag a recycler view component to activity_main.xml, give it id name "recyclerView". 2. Create a Layout for List Item Name it l…
This is my note for Udemy lesson: Advanced Android Bootcamp 2024. First, check my previous note Then in HomeFragment, do: val bundle = bundleOf("user_name" to binding.editTextText.text.toString()) it.findNavController().navigate(R.id.actio…
enum class Trend { INCREASING, DECREASING, PEAK }
This is my note for Udemy lesson: Advanced Android Bootcamp 2024. Check my previous note: Simple Data Binding Step 1 and 2 are the same. In step3, we need to write it in a different way. Before: class BlankFragment : Fragment() { override …
This is my note for Udemy lesson: Advanced Android Bootcamp 2024. 1. Add Dependencies Reference In project layer's build.gradle.kts: buildscript { ... dependencies { val nav_version = "2.7.7" classpath("androidx.navigation:navigation-safe-…
This is my note for Udemy lesson: Advanced Android Bootcamp 2024. 1. Enable xml to Access to ViewModel see this note 2. Edit ViewModel class MainActivityViewModel: ViewModel() { val userName = MutableLiveData("Frank") } 3. In xml, When Dis…
This is my note for Udemy lesson: Advanced Android Bootcamp 2024. 1. Set up Data Binding See this note 2. Set up ViewModel See this note 3. Edit ViewModel class MainActivityViewModel: ViewModel() { private val _count = MutableLiveData(0) v…
This is my note for Udemy lesson: Advanced Android Bootcamp 2024. 1. Create ViewModel Please check the previous note. 2. Edit ViewModel class MainActivityViewModel: ViewModel() { private val _count = MutableLiveData(0) val count: LiveData<Int> </int>…
This is my note for Udemy lesson: Advanced Android Bootcamp 2024. 1. Add Dependencies In app/build.gradle, add the following dependencies: dependencies { def lifecycle_version = "2.7.0" implementation "androidx.lifecycle:lifecycle-viewmode…
This is my note for Udemy lesson: Advanced Android Bootcamp 2024. 1. Set up Data Binding Please see my previous note. 2. Edit the xml File <layout ...> <data> <variable name="student" type="com.xxx.xxx.Student" /> </data> <androidx.constraintlayout.widget.ConstraintLayout ...> ... </androidx.constraintlayout.widget.constraintlayout></layout>
1. In app/build.gradle, add the following code: android { ... dataBinding { enabled = true } } Also it can be android { ... buildFeatures { dataBinding = true } } 2. Add an extra layout in layout xml file. Before: <androidx.constraintlayout.widget.ConstraintLayout xmlns:... android:...> ... </androidx.constraintlayout.widget.constraintlayout>
enum CustomizedError: LocalizedError { case unexpectedError case sessionNotExist var errorDescription: String? { switch self { case .unexpectedError: return "unexpected error" case .sessionNotExist: return "session not exist" } } }
Thread.isMainThread