can't toast on a thread that has not called looper.prepare()
inner class yourThread : Thread() {
override fun run() {
// this is for fragment, you can use 'this' for Activity
requireActivity().runOnUiThread {
// Your Toast
Toast.makeText(requireContext(), "Toasted", Toast.LENGTH_LONG).show()
}
}