Pattern selector

Most relevant patterns first. Most helpful ones displayed. Click here to show all.

  1. Button.<init>() has thrown a NullPointerException
    Android
    2
    0
    0
  2. TextView.<init>() has thrown a NullPointerException
    Android
    4
    0
    0

Your stack trace compared to the selected pattern

Jump to solutionsExpand frames
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
6 matching frames hidden
    at android.widget.Button.<init>(Button.java:107)
    at android.widget.Button.<init>(Button.java:103)
    at android.widget.Button.<init>(Button.java:99)
    at com.my.familytree.MainActivity.createButton(MainActivity.java:65)
11 frames hidden

External results for this pattern (2)

  1. Unknown authorvia Stack Overflow3 years ago
    Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
    Show stack trace
  2. JamesYTLvia Stack Overflow3 years ago
    Unable to instantiate activity ComponentInfo{com.ytl.test/com.ytl.test.MainActivity}: java.lang.NullPointerException
    Show stack trace