Created
May 4, 2019 05:21
-
-
Save francislainy/3453d57aed4029de5c0de2f4f9239af8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dataSnapshot.children.forEach { | |
val answer = it.child("cardAnswer").value as String | |
val question = it.child("cardQuestion").value as String | |
val courseId = it.child("courseId").value as String | |
val cardDs = it.value //map | |
val json = Gson().toJson(cardDs) | |
val card = Gson().fromJson<Card>(json, Card::class.java) | |
// card.cardAnswer = answer | |
// card.cardQuestion = question | |
// card.courseId = courseId | |
adapter.add(CardItem(card)) | |
} | |
data class Card(var courseId: String, var cardQuestion: String, var cardAnswer: String) { | |
constructor() : this("", "", "") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment