Why is VideoView not importing properly in android studio?

187 views Asked by At

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.

2

There are 2 answers

0
Yurii On

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

0
marcpetitvecino On

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"