My Activity is trying to create an AlertDialog which requires a Context as a parameter. This works as expected if I use:
AlertDialog.Builder builder = new Al
Guys I got a simple cheat sheet. create a file give it any name then in it write this code
fun Context.alertdialog(context: Context, msg: String, icon: Drawable, title:String){
val alertDialog = AlertDialog.Builder(context)
alertDialog.setIcon(icon)
.setTitle(title)
.setMessage(msg)
alertDialog.show()
}
now when you need to show an alert dialog only use this method anywhere
requireActivity().alertdialog(requireContext(), resources.getString(R.string.pass_title),
resources.getDrawable(R.drawable.pass_ic_name), "title")
Goodluck for Kotlin