java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference

Stack Overflow | Jagan | 9 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Context is not working on Glide when I extends Application on android

    Stack Overflow | 9 months ago | Jagan
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference
  2. 0

    GitHub comment 25#155848970

    GitHub | 1 year ago | vanitasvitae
    java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.app.Activity.isDestroyed()' on a null object reference
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Glide not working with my custom gallery

    Stack Overflow | 8 months ago | Janos
    java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.app.Activity.isDestroyed()' on a null object reference

    2 unregistered visitors

    Root Cause Analysis

    1. java.lang.NullPointerException

      Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference

      at com.bumptech.glide.load.engine.cache.MemorySizeCalculator.<init>()
    2. Glide
      Glide.with
      1. com.bumptech.glide.load.engine.cache.MemorySizeCalculator.<init>(MemorySizeCalculator.java:35)
      2. com.bumptech.glide.GlideBuilder.createGlide(GlideBuilder.java:177)
      3. com.bumptech.glide.Glide.get(Glide.java:155)
      4. com.bumptech.glide.RequestManager.<init>(RequestManager.java:62)
      5. com.bumptech.glide.RequestManager.<init>(RequestManager.java:53)
      6. com.bumptech.glide.manager.RequestManagerRetriever.supportFragmentGet(RequestManagerRetriever.java:198)
      7. com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:104)
      8. com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:87)
      9. com.bumptech.glide.Glide.with(Glide.java:629)
      9 frames
    3. com.maintainsmart.Fragments
      ProfileFragment.onCreateView
      1. com.maintainsmart.Fragments.ProfileFragment.onCreateView(ProfileFragment.java:57)
      1 frame
    4. 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.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:166)
      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
    5. Android Platform
      FrameLayout.onMeasure
      1. android.view.View.measure(View.java:18799)
      2. android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
      3. android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
      4. android.view.View.measure(View.java:18799)
      5. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
      6. android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
      6 frames
    6. Android v7
      ContentFrameLayout.onMeasure
      1. android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135)
      1 frame
    7. Android Platform
      FrameLayout.onMeasure
      1. android.view.View.measure(View.java:18799)
      2. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
      3. android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1458)
      4. android.widget.LinearLayout.measureVertical(LinearLayout.java:746)
      5. android.widget.LinearLayout.onMeasure(LinearLayout.java:629)
      6. android.view.View.measure(View.java:18799)
      7. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
      8. android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
      9. android.view.View.measure(View.java:18799)
      10. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
      11. android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1458)
      12. android.widget.LinearLayout.measureVertical(LinearLayout.java:746)
      13. android.widget.LinearLayout.onMeasure(LinearLayout.java:629)
      14. android.view.View.measure(View.java:18799)
      15. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
      16. android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
      16 frames
    8. Android
      PhoneWindow$DecorView.onMeasure
      1. com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2905)
      1 frame
    9. Android Platform
      Choreographer.doFrame
      1. android.view.View.measure(View.java:18799)
      2. android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2108)
      3. android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1224)
      4. android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1460)
      5. android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1115)
      6. android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6023)
      7. android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
      8. android.view.Choreographer.doCallbacks(Choreographer.java:670)
      9. android.view.Choreographer.doFrame(Choreographer.java:606)
      9 frames