I have an Android app that shows a toast when user perform some actions like post deletion for example , a toast appears and says "post deleted" but if we turn the android phone on the horizontal the toast appears again and again never stop. how can i make the toast stop?
postsViewModel.genericResponseLiveData.observe(this, Observer {
when (it.status) {
Status.LOADING -> { Timber.e("Loading...") }
Status.SUCCESS -> {
when (it.item) {
GenericResponse.ITEM_RESPONSE.REPORT_POST -> toast("Post reported \uD83D\uDC4A")
else -> Timber.e("Success \uD83D\uDE03")
}
}
Status.ERROR -> { toast("${it.error}. Please try again") }
}
})
} ```