Kotlin Firebase Realtime Database - Display List of Data with FirebaseRecyclerAdapter | Androidac

https://grokonez.com/android/kotlin-firebase-realtime-database-display-list-data-kotlin-firebaserecycleradapter-example-android

Kotlin Firebase Realtime Database - Display List of Data with FirebaseRecyclerAdapter | Android

In previous post, we had known how to read/write list of data object. Today, we're gonna look at way to display List of Data in an Android App with FirebaseUI FirebaseRecyclerAdapter.

Related Articles:

I. FirebaseUI Database

To use the FirebaseUI to display list of data, we need:

  • Java class for data object (Model)
  • Java class for holding UI elements that match with Model's fields (ViewHolder and layout)
  • Custom RecyclerView adapter to map from a collection from Firebase to Android (FirebaseRecyclerAdapter)
  • RecyclerView object to set the adapter to provide child views on demand.

kotlin-firebase-db-recycleradapter-demo

1. Model and ViewHolder

  • Model class is a class that represents the data from Firebase:

    
    class Message {
    
    var author: String? = ""
    var body: String? = ""
    var time: String? = ""
    
    // ...
    }
    
  • ViewHolder layout (R.layout.item_message) with UI items that correspond to Model fields:

More at:

https://grokonez.com/android/kotlin-firebase-realtime-database-display-list-data-kotlin-firebaserecycleradapter-example-android

Kotlin Firebase Realtime Database - Display List of Data with FirebaseRecyclerAdapter | Androidac

Bình luận


White
{{ comment.user.name }}
Bỏ hay Hay
{{comment.like_count}}
Male avatar
{{ comment_error }}
Hủy
   

Hiển thị thử

Chỉnh sửa

Male avatar

loveprogramming

545 bài viết.
98 người follow
Kipalog
{{userFollowed ? 'Following' : 'Follow'}}
Cùng một tác giả
Male avatar
1 0
Tutorial Link: (Link) (Ảnh) Django is a Pythonbased free and opensource web framework that follows the modeltemplateview architectural pattern. A...
loveprogramming viết 7 tháng trước
1 0
Male avatar
1 0
https://loizenai.com/angular11nodejspostgresqlcrudexample/ Angular 11 Node.js PostgreSQL Crud Example (Ảnh) Tutorial: “Angular 11 Node.js Postg...
loveprogramming viết 6 tháng trước
1 0
Male avatar
1 0
Angular Spring Boot jwt Authentication Example Github https://loizenai.com/angularspringbootjwt/ (Ảnh) Tutorial: ” Angular Spring Boot jwt Authe...
loveprogramming viết 6 tháng trước
1 0
Bài viết liên quan
Male avatar
0 0
https://grokonez.com/frontend/angular/angular4firebaseauthemailpasswordauthenticationwithangularfire2emaillogin Angular Firebase Auth Email/Passwo...
loveprogramming viết 3 tháng trước
0 0
Male avatar
0 0
https://grokonez.com/kotlin/kotlinreadwritecsvfileexample How to read/write CSV file in Kotlin In this tutorial, we're gonna look at examples tha...
loveprogramming viết 1 tháng trước
0 0
{{like_count}}

kipalog

{{ comment_count }}

bình luận

{{liked ? "Đã kipalog" : "Kipalog"}}


Male avatar
{{userFollowed ? 'Following' : 'Follow'}}
545 bài viết.
98 người follow

 Đầu mục bài viết

Vẫn còn nữa! x

Kipalog vẫn còn rất nhiều bài viết hay và chủ đề thú vị chờ bạn khám phá!