java.lang.NullPointerException: Attempt to invoke virtual method 'void android.inputmethodservice.KeyboardView.setKeyboard(android.inputmethodservice.Keyboard)' on a null object reference

Stack Overflow | Gon | 5 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

    Custom keyboardview in Fragment throws npe

    Stack Overflow | 5 months ago | Gon
    java.lang.NullPointerException: Attempt to invoke virtual method 'void android.inputmethodservice.KeyboardView.setKeyboard(android.inputmethodservice.Keyboard)' on a null object reference

    Root Cause Analysis

    1. java.lang.NullPointerException

      Attempt to invoke virtual method 'void android.inputmethodservice.KeyboardView.setKeyboard(android.inputmethodservice.Keyboard)' on a null object reference

      at com.gontavahl.mtgsync.CustomKeyboard.<init>()
    2. com.gontavahl.mtgsync
      FragmentGame.onCreateView
      1. com.gontavahl.mtgsync.CustomKeyboard.<init>(CustomKeyboard.java:25)
      2. com.gontavahl.mtgsync.FragmentGame.onCreateView(FragmentGame.java:36)
      2 frames
    3. Android Support v4
      ViewPager.onMeasure
      1. android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
      2. android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
      3. android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
      4. android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
      5. android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
      6. android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:570)
      7. android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141)
      8. android.support.v4.view.ViewPager.populate(ViewPager.java:1177)
      9. android.support.v4.view.ViewPager.populate(ViewPager.java:1025)
      10. android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1545)
      10 frames
    4. Android Platform
      ViewGroup.measureChildWithMargins
      1. android.view.View.measure(View.java:17565)
      2. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5537)
      2 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:17565)
      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:17565)
      2. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5537)
      3. android.widget.FrameLayout.onMeasure(FrameLayout.java:436)
      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:17565)
      2. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5537)
      3. android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
      4. android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
      5. android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
      6. android.view.View.measure(View.java:17565)
      7. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5537)
      8. android.widget.FrameLayout.onMeasure(FrameLayout.java:436)
      9. android.view.View.measure(View.java:17565)
      10. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5537)
      11. android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
      12. android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
      13. android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
      14. android.view.View.measure(View.java:17565)
      15. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5537)
      16. android.widget.FrameLayout.onMeasure(FrameLayout.java:436)
      16 frames
    11. Android
      PhoneWindow$DecorView.onMeasure
      1. com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2615)
      1 frame
    12. Android Platform
      ActivityThread.main
      1. android.view.View.measure(View.java:17565)
      2. android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2045)
      3. android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1811)
      4. android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1084)
      5. android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5990)
      6. android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
      7. android.view.Choreographer.doCallbacks(Choreographer.java:580)
      8. android.view.Choreographer.doFrame(Choreographer.java:550)
      9. android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
      10. android.os.Handler.handleCallback(Handler.java:739)
      11. android.os.Handler.dispatchMessage(Handler.java:95)
      12. android.os.Looper.loop(Looper.java:135)
      13. android.app.ActivityThread.main(ActivityThread.java:5343)
      13 frames
    13. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invoke(Native Method)
      2. java.lang.reflect.Method.invoke(Method.java:372)
      2 frames
    14. Android
      ZygoteInit$MethodAndArgsCaller.run
      1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
      1 frame