MaterialIntroView
MaterialIntroView copied to clipboard
Crash Android 7 only: NullPointerException View.getLocationInWindow(int[])
Hi Mert,
Awesome library! Have started seeing crashlogs coming in that relate to the library and only in Android 7.x
Below is the crash log, and the code I am using to configure the library. I am calling the tour after the activity has fully loaded (outside of onCreate). Do you have any suggestions?
Crash log
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.getLocationInWindow(int[])' on a null object reference at co.mobiwise.materialintro.target.ViewTarget.getPoint(ViewTarget.java:22) at co.mobiwise.materialintro.shape.Circle.getFocusPoint(Circle.java:60) at co.mobiwise.materialintro.shape.Circle.<init>(Circle.java:40) at co.mobiwise.materialintro.view.MaterialIntroView$Builder.build(MaterialIntroView.java:714) at co.mobiwise.materialintro.view.MaterialIntroView$Builder.show(MaterialIntroView.java:724) at mobi.jukestar.jukestarhost.PartyActivity.showIntro(PartyActivity.java:515) at mobi.jukestar.jukestarhost.PartyActivity.firstTimeTour(PartyActivity.java:507) at mobi.jukestar.jukestarhost.PartyActivity$6.onInitialized(PartyActivity.java:410) at com.spotify.sdk.android.player.Player$2.run(Player.java:400) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Library config
public void showIntro(View view, String id, String text, FocusGravity focusGravity, Boolean continuing) {
int delay = 750;
if (continuing) {delay = 250;}
new MaterialIntroView.Builder(PartyActivity.this)
.enableDotAnimation(false)
.setFocusGravity(focusGravity)
.setFocusType(Focus.NORMAL)
.setDelayMillis(delay)
.setTargetPadding(10)
.enableFadeAnimation(true)
.performClick(false) //True means the underlying button is also tapped
.setInfoText(text)
.setTarget(view)
.setListener(this)
.setUsageId(id)
.show();
}
I happened a similar exception, because of the target view is null object.
Especially if your target view is menu item in toolbar please check it.
@ntust0001 did you find any solutions for this issue ?
same error here.. i have to disable this on build 7.0
If someone find the solution.please share with us :)