Home > Software engineering >  Why is VideoView not importing properly in android studio?
Why is VideoView not importing properly in android studio?

Time:12-14

image of code

I am taking an android development course through coursera and cannot figure out why import android.widget.VideoView is gray as though it is not working and findViewById is showing an error.

CodePudding user response:

Try this val videoView: VideoView = findViewById<VideoView>(R.id.textView)

CodePudding user response:

You need to specify the type of the view when calling findViewById(), either this way

val videoView: VideoView = findViewById(R.id.textView)

or this way

val videoView = findViewById<VideoView>(R.id.textView)

It's not a problem with the import, if you check the error, you will see that the error is

"Not enough information to infer parameter T"
  • Related