java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setAdapter(android.support.v7.widget.RecyclerView$Adapter)' on a null object reference

Stack Overflow | Alan | 10 months ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    AsyncTask RecyclerView NullPointerException

    Stack Overflow | 10 months ago | Alan
    java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setAdapter(android.support.v7.widget.RecyclerView$Adapter)' on a null object reference

    Root Cause Analysis

    1. java.lang.NullPointerException

      Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setAdapter(android.support.v7.widget.RecyclerView$Adapter)' on a null object reference

      at br.unisinos.mobicine.classes.WorkInBackground.<init>()
    2. br.unisinos.mobicine
      DrugstoreFragment.onViewCreated
      1. br.unisinos.mobicine.classes.WorkInBackground.<init>(WorkInBackground.java:69)
      2. br.unisinos.mobicine.fragments.DrugstoreFragment.initDataset(DrugstoreFragment.java:114)
      3. br.unisinos.mobicine.fragments.DrugstoreFragment.onViewCreated(DrugstoreFragment.java:93)
      3 frames
    3. Android Support v4
      ViewPager.onMeasure
      1. android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
      2. android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
      3. android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
      4. android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
      5. android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:570)
      6. android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141)
      7. android.support.v4.view.ViewPager.populate(ViewPager.java:1177)
      8. android.support.v4.view.ViewPager.populate(ViewPager.java:1025)
      9. android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1545)
      9 frames
    4. Android Platform
      ViewGroup.measureChildWithMargins
      1. android.view.View.measure(View.java:18788)
      2. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
      3. android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
      4. android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
      5. android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
      6. android.view.View.measure(View.java:18788)
      7. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
      8. android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
      9. android.view.View.measure(View.java:18788)
      10. android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
      11. android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
      12. android.view.View.measure(View.java:18788)
      13. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
      13 frames
    5. android.support.design
      CoordinatorLayout.onMeasure
      1. android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:668)
      2. android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:735)
      2 frames
    6. Android Platform
      View.measure
      1. android.view.View.measure(View.java:18788)
      1 frame
    7. Android Support v4
      DrawerLayout.onMeasure
      1. android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:1075)
      1 frame
    8. Android Platform
      FrameLayout.onMeasure
      1. android.view.View.measure(View.java:18788)
      2. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
      3. android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
      3 frames
    9. Android v7
      ContentFrameLayout.onMeasure
      1. android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135)
      1 frame
    10. Android Platform
      FrameLayout.onMeasure
      1. android.view.View.measure(View.java:18788)
      2. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
      3. android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
      4. android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
      5. android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
      6. android.view.View.measure(View.java:18788)
      7. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
      8. android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
      9. android.view.View.measure(View.java:18788)
      10. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
      11. android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
      12. android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
      13. android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
      14. android.view.View.measure(View.java:18788)
      15. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
      16. android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
      16 frames
    11. Android
      PhoneWindow$DecorView.onMeasure
      1. com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2643)
      1 frame
    12. Android Platform
      ViewRootImpl.measureHierarchy
      1. android.view.View.measure(View.java:18788)
      2. android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2100)
      3. android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1216)
      3 frames