question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NullPointerException

See original GitHub issue

i just integrated the library and i got this Error on launching the app

FATAL EXCEPTION: main Process: com.wadeeny.ondemand, PID: 20144 java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.view.View.isNestedScrollingEnabled()' on a null object reference at android.support.v4.view.ViewCompat$ViewCompatApi21Impl.isNestedScrollingEnabled(ViewCompat.java:1320) at android.support.v4.view.ViewCompat.isNestedScrollingEnabled(ViewCompat.java:3308) at biz.laenger.android.vpbs.ViewPagerBottomSheetBehavior.findScrollingChild(ViewPagerBottomSheetBehavior.java:609) at biz.laenger.android.vpbs.ViewPagerBottomSheetBehavior.findScrollingChild(ViewPagerBottomSheetBehavior.java:615) at biz.laenger.android.vpbs.ViewPagerBottomSheetBehavior.findScrollingChild(ViewPagerBottomSheetBehavior.java:622) at biz.laenger.android.vpbs.ViewPagerBottomSheetBehavior.onLayoutChild(ViewPagerBottomSheetBehavior.java:252) at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:894) at android.view.View.layout(View.java:19590) at android.view.ViewGroup.layout(ViewGroup.java:6053) at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1171) at android.view.View.layout(View.java:19590) at android.view.ViewGroup.layout(ViewGroup.java:6053) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:19590) at android.view.ViewGroup.layout(ViewGroup.java:6053) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:19590) at android.view.ViewGroup.layout(ViewGroup.java:6053) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635) at android.widget.LinearLayout.onLayout(LinearLayout.java:1544) at android.view.View.layout(View.java:19590) at android.view.ViewGroup.layout(ViewGroup.java:6053) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:19590) at android.view.ViewGroup.layout(ViewGroup.java:6053) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635) at android.widget.LinearLayout.onLayout(LinearLayout.java:1544) at android.view.View.layout(View.java:19590) at android.view.ViewGroup.layout(ViewGroup.java:6053) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at com.android.internal.policy.DecorView.onLayout(DecorView.java:758) at android.view.View.layout(View.java:19590) at android.view.ViewGroup.layout(ViewGroup.java:6053) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2488) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2204) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1390) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6754) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:966) at android.view.Choreographer.doCallbacks(Choreographer.java:778) at android.view.Choreographer.doFrame(Choreographer.java:713) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:952) at android.os.Handler.handleCallback(Handler.java:789) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:172) at android.app.ActivityThread.main(ActivityThread.java:6637) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
daniellAlgarcommented, Sep 18, 2018

I was also having this problem. I solved it by adding android:nestedScrollingEnabled="true" to my ViewPager.

0reactions
beelancrpcommented, Oct 2, 2018

For a better understanding, I show you how I use it. ` override fun onViewCreated(view: View, savedInstanceState: Bundle?) {super.onViewCreated(view, savedInstanceState)

    pagerAdapter = StoryBoardStatsFragmentPagerAdapter(activity!!.supportFragmentManager)

    if (storyResponse.likedusers.isNotEmpty()) {
        pagerAdapter.addFragment(StoryDetailsTabFragment.newInstance(
                StoryDetailsTabFragment.TabType.LIKES, storyResponse, this),
                storyResponse.likeCount.toString().plus(" likes"))
    }

    if (storyResponse.viewedusers.isNotEmpty()) {
        pagerAdapter.addFragment(StoryDetailsTabFragment.newInstance(
                StoryDetailsTabFragment.TabType.VIEWS, storyResponse, this),
                storyResponse.viewCount.toString().plus(" views"))
    }

    viewPager.offscreenPageLimit = 1
    viewPager.adapter = pagerAdapter

    tabs.setupWithViewPager(viewPager)
}

override fun onDataLoaded() {
    viewPager.post {
        behavior = ViewPagerBottomSheetBehavior.from(container)

        behavior.isHideable = true
        behavior.setBottomSheetCallback(object : ViewPagerBottomSheetBehavior.BottomSheetCallback() {
            override fun onSlide(bottomSheet: View, slideOffset: Float) {
                val percent = slideOffset * 100
                if (percent <= 45 && wasExpanded)
                    behavior.state = ViewPagerBottomSheetBehavior.STATE_HIDDEN
            }

            override fun onStateChanged(bottomSheet: View, newState: Int) {
                if (newState == BottomSheetBehavior.STATE_EXPANDED)
                    wasExpanded = true

                if (newState == BottomSheetBehavior.STATE_HIDDEN)
                    router.clearStackFragment()
            }
        })

        BottomSheetUtils.setupViewPager(viewPager) {
            router.clearStackFragment()
        }
    }
}`
Read more comments on GitHub >

github_iconTop Results From Across the Web

NullPointerException (Java Platform SE 7 ) - Oracle Help Center
Thrown when an application attempts to use null in a case where an object is required. These include: ... Applications should throw instances...
Read more >
java - What is a NullPointerException, and how do I fix it?
NullPointerException s are exceptions that occur when you try to use a reference that points to no location in memory ...
Read more >
How to Fix and Avoid NullPointerException in Java - Rollbar
The NullPointerException occurs due to a situation in application code where an uninitialized object is attempted to be accessed or modified.
Read more >
Null Pointer Exception In Java - GeeksforGeeks
NullPointerException is a RuntimeException. In Java, a special null value can be assigned to an object reference. NullPointerException is thrown ...
Read more >
Java NullPointerException - Detect, Fix, and Best Practices
NullPointerException is a runtime exception, so we don't need to catch it in the program. NullPointerException is raised in an application ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found