Skip to content

Instantly share code, notes, and snippets.

Created Aug 31, 2017
What would you like to do?
* Once data is here - display it
private fun setupAdapter(data: ArrayList<Message>){
val linearLayoutManager = LinearLayoutManager(this)
mainActivityRecyclerView.layoutManager = linearLayoutManager
mainActivityRecyclerView.adapter = MessageAdapter(data) {
Toast.makeText(this, "${it.text} clicked", Toast.LENGTH_SHORT).show()
//scroll to bottom
mainActivityRecyclerView.scrollToPosition(data.size - 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment