NPE
yolapop opened this issue · 4 comments
yolapop commented
06-16 16:55:36.242 27838-27838/com W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.text.Layout.getLineCount()' on a null object reference
06-16 16:55:36.244 27838-27838/com W/System.err: at com.borjabravo.readmoretextview.ReadMoreTextView.refreshLineEndIndex(ReadMoreTextView.java:219)
06-16 16:55:36.244 27838-27838/com W/System.err: at com.borjabravo.readmoretextview.ReadMoreTextView.access$400(ReadMoreTextView.java:36)
06-16 16:55:36.244 27838-27838/com W/System.err: at com.borjabravo.readmoretextview.ReadMoreTextView$1.onGlobalLayout(ReadMoreTextView.java:205)
06-16 16:55:36.244 27838-27838/com W/System.err: at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:912)
06-16 16:55:36.244 27838-27838/com W/System.err: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1969)
06-16 16:55:36.244 27838-27838/com W/System.err: at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
06-16 16:55:36.244 27838-27838/com W/System.err: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
06-16 16:55:36.244 27838-27838/com W/System.err: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
06-16 16:55:36.244 27838-27838/com W/System.err: at android.view.Choreographer.doCallbacks(Choreographer.java:670)
06-16 16:55:36.244 27838-27838/com W/System.err: at android.view.Choreographer.doFrame(Choreographer.java:606)
06-16 16:55:36.244 27838-27838/com W/System.err: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
06-16 16:55:36.245 27838-27838/com W/System.err: at android.os.Handler.handleCallback(Handler.java:739)
06-16 16:55:36.245 27838-27838/com W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
06-16 16:55:36.245 27838-27838/com W/System.err: at android.os.Looper.loop(Looper.java:148)
06-16 16:55:36.245 27838-27838/com W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5417)
06-16 16:55:36.245 27838-27838/com W/System.err: at java.lang.reflect.Method.invoke(Native Method)
06-16 16:55:36.245 27838-27838/com W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
06-16 16:55:36.245 27838-27838/com W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Tested on device lollipop.
bravoborja commented
@yolapop Can you pass an example of your code? I tested on lollipop versions and it works
I cannot reproduce this issue. Please, I need your feedback
yolapop commented
I don't know, I call it as usual. Now my code has changed.
maybe the layout is still null, try to use this
textview.post(new Runnable() {
@Override
public void run() {
Layout l = textview.getLayout();
if (l != null) {
// something
}
}
});
yolapop commented
Maybe you could try to set visibility to GONE for a few seconds to try reproduce the issue
bravoborja commented