Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhotoViewAttacher.getScaleType()' on a null object reference #768

Open
kelinZhou opened this issue Jul 17, 2020 · 5 comments
Open

PhotoViewAttacher.getScaleType()' on a null object reference #768

kelinZhou opened this issue Jul 17, 2020 · 5 comments

Comments

@kelinZhou
Copy link

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
Copy link
Author

And the touch event for ViewPager2 still works during scaling.

@kelinZhou
Copy link
Author

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

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

@TonyNikolov
Copy link

@kelinZhou where exactly do you make this check?

@PontonMao
Copy link

<---?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...

@Lupin-Appsynth
Copy link

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

Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants