Home > Net >  Data not visible
Data not visible

Time:05-07

  1. My Variable Class
data class QnaVariable( val questionOne: String, val answerOne : String,  val questionTwo: String, val answerTwo : String)
  1. My ViewModel Class
    val item = QnaVariable("I am unable to login my account",
        "You can reset password using the Reset Password in My account Page. If you are still unable to access your account, then please call our customer care.",
        "Still need help?",
        "Have a queries? please get in touch and we will be happy to help you")

}
  1. My Fragment Class
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        binding = FragmentQuestionAnswerBinding.inflate(layoutInflater, container, false)

        val model = viewModel.item

        //binding.questionHeading1.text = model.toString()
        binding.questionHeading1.text = QNAdapter(myList).toString()

        return binding.root
    }
}

CodePudding user response:

return FragmentQuestionAnswerBinding.inflate(layoutInflater, container, false).apply { 
    binding = this
    //TODO: write code to update your ui
}.root

Modify binding part like this.

  • Related