I am stuck with this error
Return type of 'onCreateDialog' is not a subtype of the return type of the overridden member 'protected/protected and package/ open fun onCreateDialog(p0: Int): Dialog! defined in androidx.appcompat.app.AppCompatActivity'
I've just migrated my project from java to kotlin and now I am facing this kind of error and it is new to me, so any help will be much appreciated.
Code:
override fun onCreateDialog(id: Int): () -> ProgressDialog? {
return when (id) {
progress_bar_type -> ({
pDialog = ProgressDialog(this)
pDialog!!.setMessage("Sending Application. Please wait...")
pDialog!!.isIndeterminate = false
pDialog!!.max = 100
pDialog!!.setProgressStyle(ProgressDialog.STYLE_SPINNER)
pDialog!!.setCancelable(true)
pDialog!!.show()
pDialog
})!!
else -> null
}
}
onCreateDialog
:) – Ric17101fun onCreateDialog(id: Int): Dialog
just remove the method type it agin with suggestion . AlsoonCreateDialog
is deprecated i guess . – ADM