Skip to content

Instantly share code, notes, and snippets.

@peterpazmandi
Created June 12, 2020 04:02
Show Gist options
  • Save peterpazmandi/c8963e7338fb061de8771ea37a77a2f3 to your computer and use it in GitHub Desktop.
Save peterpazmandi/c8963e7338fb061de8771ea37a77a2f3 to your computer and use it in GitHub Desktop.
private fun showCustomToast(message: String)
{
val layout = layoutInflater.inflate (
R.layout.custom_toast,
findViewById(R.id.cl_customToastContainer)
)
val textView = layout.findViewById(R.id.tv_message)
textView.text = message
val toast = Toast(applicationContext)
toast.apply {
setGravity(Gravity.BOTTOM, 0, 40)
duration = Toast.LENGTH_LONG
view = layout
show()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment