laenger / ViewPagerBottomSheet

Use ViewPagers in Bottom Sheets!
Apache License 2.0
465 stars 86 forks source link

crash app after update support library:design to 27.0.2 #19

Closed rasoulinejad closed 6 years ago

rasoulinejad commented 6 years ago

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v4.widget.ViewDragHelper.processTouchEvent(android.view.MotionEvent)' on a null object reference at biz.laenger.android.vpbs.ViewPagerBottomSheetBehavior.onTouchEvent(ViewPagerBottomSheetBehavior.java:320)

andyken commented 6 years ago

same problem

vivekav-96 commented 6 years ago

Same issue here

crino commented 6 years ago

In biz.laenger.android.vpbs.ViewPagerBottomSheetBehavior line 320 should be if (mViewDragHelper != null) { mViewDragHelper.processTouchEvent(event); }

javaghost commented 6 years ago

Or one could add following code Below this Line:

if (mViewDragHelper == null) {
    mViewDragHelper = ViewDragHelper.create(parent, mDragCallback);
}
tamhuynhit commented 6 years ago

Same to me :(

yamzzzz commented 6 years ago

For now, we can do the following:

 bottomSheet.post(new Runnable() {
            @Override
            public void run() {
                bottomSheetBehavior = ViewPagerBottomSheetBehavior.from(bottomSheet);
            }
        });
laenger commented 6 years ago

just ported the changes from support lib 27.1.0. please let me know if version 0.0.5 solves your issues

tamhuynhit commented 6 years ago

It works for me, thanks @laenger