findViewById with PhotoView library problem

154 Views Asked by At

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"

1

There are 1 best solutions below

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