PhotoView icon indicating copy to clipboard operation
PhotoView copied to clipboard

PhotoViewAttacher.getScaleType()' on a null object reference

Open kelinZhou opened this issue 4 years ago • 5 comments

my app use ViewPager2 + PhotoView + Glide, to see a few picture, the app crash. version 1.3.1

java.lang.NullPointerException: Attempt to invoke virtual method 'android.widget.ImageView$ScaleType uk.co.senab.photoview.PhotoViewAttacher.getScaleType()' on a null object reference at uk.co.senab.photoview.PhotoView.getScaleType(PhotoView.java:115) at com.bumptech.glide.RequestBuilder.into(RequestBuilder.java:680)

kelinZhou avatar Jul 17 '20 08:07 kelinZhou

And the touch event for ViewPager2 still works during scaling.

kelinZhou avatar Jul 17 '20 08:07 kelinZhou

Issues:The touch event for ViewPager2 still works during scaling.

You can call parent.requestDisallowInterceptTouchEvent(true) method when MotionEvent.getPointerCount() > 1.

kelinZhou avatar Jul 17 '20 08:07 kelinZhou

@kelinZhou where exactly do you make this check?

TonyNikolov avatar Mar 11 '21 14:03 TonyNikolov

<---?xml version="1.0" encoding="utf-8"?-->

<---LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:gravity="center">

<com.github.chrisbanes.photoview.PhotoView
    android:id="@+id/pvPhotoView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

<--/LinearLayout-->

try this...

PontonMao avatar Feb 14 '22 07:02 PontonMao

I'm using this approach with waiting for an image view display by the GlobalLayout listener to solve this issue.

Thanks!!

Lupin-Appsynth avatar Mar 03 '22 11:03 Lupin-Appsynth