0

I am using the PhotoView library to display some images.

When I try to use PhotoView with Picasso, as shown in the sample I get ClassCastException on this line:

PhotoView photoView = (PhotoView) findViewById(R.id.imageViewTest);

This is what's shown in the stack trace:

Caused by: java.lang.ClassCastException: android.support.v7.widget.AppCompatImageView cannot be cast to uk.co.senab.photoview.PhotoView

Am I missing something?

BabbevDan
  • 1,160
  • 3
  • 14
  • 26

1 Answers1

1

You need to use the PhotoView in your XML too, not ImageView. Do something like following:

<uk.co.senab.photoview.PhotoView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/imageViewTest"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"/>
Yogesh Umesh Vaity
  • 41,009
  • 21
  • 145
  • 105