I am trying to use PhotoView library with Kotlin.

But when I try to get photoView as in exaple:

val photoView = mView.findViewById<PhotoView>(R.id.zoomImageView)

I got error "Type argument is not within its bounds. Expected: View! Found: PhotoView"

2 Answers

-1
vikas sharma On

you can use as

val photoView: PhotoView = mView.findViewById<PhotoView>(R.id.zoomImageView)
2
Mr. Patel On

In your case issue is with typecasting either remove the typecasting or do something like this:

There are two ways you can fix this:

1)val photoView= mView.findViewById(R.id.zoomImageView)

2)val photoView:PhotoView= mView.findViewById(R.id.zoomImageView) as PhotoView