Home > database >  Why the onActivityResult function is not getting overridden?
Why the onActivityResult function is not getting overridden?

Time:01-03

Modifier 'override' is not applicable to 'local function'

I have tried checking every opening and closing braces and also restarted Android Studio.

CodePudding user response:

move your method below closing bracket of onCreate call

override fun onCreate(savedInstanceState: Bundle?) {
    ... current code
}

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    ... new code
}

private fun generateSampleData(): List<UserMap> {
    ... rest of current code

this method belongs to whole class extending Activity not "local function", as on the screenshout you are placing it inside another overriden method

btw. onActivityResult is deprecated now, you should move to new aproach

  • Related