java.lang.NullPointerException: Attempt to invoke virtual method 'int android.text.Layout.getLineForOffset(int)' on a null object reference

Stack Overflow | Bhushan Babar | 2 months ago
  1. 0

    return layout.getLineForOffset(selectionStart); crashing my app

    Stack Overflow | 2 months ago | Bhushan Babar
    java.lang.NullPointerException: Attempt to invoke virtual method 'int android.text.Layout.getLineForOffset(int)' on a null object reference
  2. 0

    crash report

    GitHub | 12 months ago | door43app
    java.lang.NullPointerException: Attempt to invoke virtual method 'int android.text.Layout.getLineForOffset(int)' on a null object reference
  3. 0

    crash report

    GitHub | 12 months ago | door43app
    java.lang.NullPointerException: Attempt to invoke virtual method 'int android.text.Layout.getLineForOffset(int)' on a null object reference
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    crash report

    GitHub | 12 months ago | door43app
    java.lang.NullPointerException: Attempt to invoke virtual method 'int android.text.Layout.getLineForOffset(int)' on a null object reference
  6. 0

    crash report

    GitHub | 12 months ago | door43app
    java.lang.NullPointerException: Attempt to invoke virtual method 'int android.text.Layout.getLineForOffset(int)' 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 'int android.text.Layout.getLineForOffset(int)' on a null object reference

      at com.example.tabstrial2.TabFragment1.getCurrentCursorLine()
    2. com.example.tabstrial2
      TabFragment1$2.onTextChanged
      1. com.example.tabstrial2.TabFragment1.getCurrentCursorLine(TabFragment1.java:451)
      2. com.example.tabstrial2.TabFragment1$2.onTextChanged(TabFragment1.java:169)
      2 frames
    3. Android Platform
      View.restoreHierarchyState
      1. android.widget.TextView.sendOnTextChanged(TextView.java:7689)
      2. android.widget.TextView.setText(TextView.java:4070)
      3. android.widget.TextView.setText(TextView.java:3925)
      4. android.widget.EditText.setText(EditText.java:85)
      5. android.widget.TextView.setText(TextView.java:3900)
      6. android.widget.TextView.onRestoreInstanceState(TextView.java:3800)
      7. android.view.View.dispatchRestoreInstanceState(View.java:13754)
      8. android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2894)
      9. android.view.View.restoreHierarchyState(View.java:13732)
      9 frames
    4. Android Support v4
      ViewPager.setCurrentItem
      1. android.support.v4.app.Fragment.restoreViewState(Fragment.java:477)
      2. android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1135)
      3. android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1290)
      4. android.support.v4.app.BackStackRecord.run(BackStackRecord.java:801)
      5. android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1638)
      6. android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:679)
      7. android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:166)
      8. android.support.v4.view.ViewPager.populate(ViewPager.java:1240)
      9. android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:670)
      10. android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:632)
      11. android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:613)
      11 frames
    5. com.example.tabstrial2
      MainActivity.onNavigationItemSelected
      1. com.example.tabstrial2.MainActivity.onNavigationItemSelected(MainActivity.java:569)
      1 frame
    6. android.support.design
      NavigationView$1.onMenuItemSelected
      1. android.support.design.widget.NavigationView$1.onMenuItemSelected(NavigationView.java:153)
      1 frame
    7. android.support.v7
      MenuBuilder.performItemAction
      1. android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:810)
      2. android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:152)
      3. android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:957)
      3 frames
    8. android.support.design
      NavigationMenuPresenter$1.onClick
      1. android.support.design.internal.NavigationMenuPresenter$1.onClick(NavigationMenuPresenter.java:328)
      1 frame
    9. Android Platform
      ActivityThread.main
      1. android.view.View.performClick(View.java:4783)
      2. android.view.View$PerformClick.run(View.java:19887)
      3. android.os.Handler.handleCallback(Handler.java:739)
      4. android.os.Handler.dispatchMessage(Handler.java:95)
      5. android.os.Looper.loop(Looper.java:135)
      6. android.app.ActivityThread.main(ActivityThread.java:5290)
      6 frames
    10. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invoke(Native Method)
      2. java.lang.reflect.Method.invoke(Method.java:372)
      2 frames
    11. Android
      ZygoteInit.main
      1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:911)
      2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:706)
      2 frames