You are currently viewing Error with inner class using android.location.LocationListener

Error with inner class using android.location.LocationListener

Hey guys,

in my studybooks I was adviced to put the following code in my learning project (toppings GPS):

“inner class NoteLocationListener : LocationListener {
override fun onLocationChanged(location: Location?) {
Log.d(javaClass.simpleName, “Empfangene Geodaten:n$location”)
val textview = findViewById<TextView>(R.id.textview_output)
textview.append(“nEmpfangene Geodaten:n$location”)
}

override fun onStatusChanged(provider: String?, status: Int, extras: Bundle?) {
}

override fun onProviderEnabled(provider: String?) {
}

override fun onProviderDisabled(provider: String?) {
}
}
val locationListener = NoteLocationListener()”

This code was provided from my university. I checked it many times and got no typo. Unfortunately I get the following error, when I want to start this in my Android Studio project:

“Class ‘NoteLocationListener’ is not abstract and does not implement abstract member public abstract fun onLocationChanged(p0: Location): Unit defined in android.location.LocationListener”

Unfortunately I dont find the solution through this to continue with my learning book. Would somebody so kind and put me in the right direction? Since this code part was exactly in my book to use and work with + I am too unexperienced, I do not see, what is wrong here.

Thanks a lot!

submitted by /u/TheBlackPersian
[link] [comments]