![]() ![]() The DiffUtil utility class exists to improve RecyclerView’s performance when handling list updates. Moving on, it’s time to learn more about DiffUtil. To learn more advanced content about how to use this view, check out Android RecyclerView Tutorial with Kotlin or Intermediate RecyclerView Tutorial with Kotlin. Note: In this tutorial, you’ll use RecyclerView to display your grocery list. Namely, you’ll use these to save and load your grocery list into and from shared preferences and format a note timestamp to an easily readable date. Utils.kt: This file contains a set of utility methods you’ll use throughout the project.MainFragment: Responsible for displaying the grocery list to the user and providing a set of mechanisms with which the user can interact.MainActivity: The app’s single activity.Item consists of id, its value, the timeStamp of when it was created and a Boolean flag - done - that indicates if item was checked or not. ![]() model: Contains the Item data object to represent an item.adapters: Contains the RecyclerView adapter and a set the utilities used to select one or more items from the list.You’ll see a set of subfolders and other important files: ![]() Open the Starter project in Android Studio and wait for it to synchronize. :]īut first, you’ll take some time to understand the project structure. And it has a bonus feature! The item Cookies is always on the list, because there’s always room for more cookies. So, you’re going to create BringCookies, a grocery list app that helps you keep track of everything you need to buy on your next trip to the store. But you most likely always have your phone with you. The best approach is to write a shopping list in advance, but sometimes those get left at home. You can probably relate to returning home from the store, only to realize you forgot to buy everything you needed. In the image above, you see a grocery list. Starter has the skeleton of the app you’ll build, and Final gives you something to compare your code to when you’re done. You’ll find two projects inside the ZIP file. If you’re new to either, read through Beginning Android Development and Kotlin for Android: An Introduction before continuing.ĭownload the starter project by clicking the Download Materials button at the top or bottom of the tutorial. Note: This tutorial assumes you’re familiar with Android Studio and the basics of Android development. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |