java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference

  1. 0

    Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference

    Stack Overflow | 4 months ago | Олег Медведев
    java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
  2. 0
    The resource was accessed after it was dismissed.
  3. 0
    Initialize the variable before calling a method on it.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0
    Use 'dialog' to access views from custom_layout layout.
  6. 0

    Java Android NullPointerExceptionIT怪 挨踢怪 28印象 二八印象

    28im.com | 1 year ago
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.kristofer.myapplication/com.example.kristofer.myapplication.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference

      at com.smartfon_apps.timetable_sch32.Db$DbHelper.onCreate()
    2. com.smartfon_apps.timetable_sch32
      Db$DbHelper.onCreate
      1. com.smartfon_apps.timetable_sch32.Db$DbHelper.onCreate(Db.java:68)
      1 frame
    3. Android Platform
      SQLiteOpenHelper.getReadableDatabase
      1. android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:251)
      2. android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:187)
      2 frames
    4. com.smartfon_apps.timetable_sch32
      MondayFragment.onCreateView
      1. com.smartfon_apps.timetable_sch32.Db.getAllItems(Db.java:38)
      2. com.smartfon_apps.timetable_sch32.MondayFragment.onCreateView(MondayFragment.java:33)
      2 frames
    5. Android Support v4
      ViewPager.onMeasure
      1. android.support.v4.app.Fragment.performCreateView(Fragment.java:2074)
      2. android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
      3. android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1286)
      4. android.support.v4.app.BackStackRecord.run(BackStackRecord.java:758)
      5. android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1632)
      6. android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:637)
      7. android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:143)
      8. android.support.v4.view.ViewPager.populate(ViewPager.java:1237)
      9. android.support.v4.view.ViewPager.populate(ViewPager.java:1085)
      10. android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1611)
      10 frames
    6. Android Platform
      ViewGroup.measureChildWithMargins
      1. android.view.View.measure(View.java:17496)
      2. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5466)
      2 frames
    7. android.support.design
      CoordinatorLayout.onMeasure
      1. android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:671)
      2. android.support.design.widget.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:90)
      3. android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onMeasureChild(AppBarLayout.java:1319)
      4. android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:736)
      4 frames
    8. Android Platform
      FrameLayout.onMeasure
      1. android.view.View.measure(View.java:17496)
      2. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5466)
      3. android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
      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:17496)
      2. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5466)
      3. android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1438)
      4. android.widget.LinearLayout.measureVertical(LinearLayout.java:724)
      5. android.widget.LinearLayout.onMeasure(LinearLayout.java:615)
      6. android.view.View.measure(View.java:17496)
      7. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5466)
      8. android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
      9. android.view.View.measure(View.java:17496)
      10. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5466)
      11. android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1438)
      12. android.widget.LinearLayout.measureVertical(LinearLayout.java:724)
      13. android.widget.LinearLayout.onMeasure(LinearLayout.java:615)
      14. android.view.View.measure(View.java:17496)
      15. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5466)
      16. android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
      16 frames
    11. Android
      PhoneWindow$DecorView.onMeasure
      1. com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2636)
      1 frame
    12. Android Platform
      Choreographer.doFrame
      1. android.view.View.measure(View.java:17496)
      2. android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2031)
      3. android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1193)
      4. android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1400)
      5. android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1078)
      6. android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5875)
      7. android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
      8. android.view.Choreographer.doCallbacks(Choreographer.java:580)
      9. android.view.Choreographer.doFrame(Choreographer.java:550)
      9 frames