Spotlight
Spotlight copied to clipboard
#15 issue still exist
Reproduced on Android version: Android 7.0 Device: Galaxy S8+ (dream2lte) Manufacturer: Samsung RAM (MB) 4096 Screen size 1080 × 2008 Screen density (dpi) 420 Native platform armeabi-v7a OpenGL ES version 3.2 CPU make Samsung CPU model Exynos 8895
Fatal Exception: java.lang.IllegalStateException: Cannot start this animator on a detached view! at android.view.RenderNode.addAnimator(RenderNode.java:863) at android.view.RenderNodeAnimator.setTarget(RenderNodeAnimator.java:300) at android.view.RenderNodeAnimator.setTarget(RenderNodeAnimator.java:282) at android.animation.RevealAnimator.(RevealAnimator.java) at android.view.ViewAnimationUtils.createCircularReveal(ViewAnimationUtils.java:55) at com.wooplr.spotlight.SpotlightView.startRevealAnimation(SpotlightView.java:358) at com.wooplr.spotlight.SpotlightView.access$100(SpotlightView.java:54) at com.wooplr.spotlight.SpotlightView$1.run(SpotlightView.java:319) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7409) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Here too.
I added a possible fix based on crash logs and your suggestions in SpotlightView class.
private void show(final Activity activity) {
if (preferencesManager.isDisplayed(usageId))
return;
((ViewGroup) activity.getWindow().getDecorView()).addView(this);
setReady(true);
SpotlightView.this.post(new Runnable() {
@Override
public void run() {
try{
boolean isAttachedToWindow = true;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
isAttachedToWindow = SpotlightView.this.isAttachedToWindow();
}
if(isAttachedToWindow) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (isRevealAnimationEnabled)
startRevealAnimation(activity);
else {
startFadinAnimation(activity);
}
} else {
startFadinAnimation(activity);
}
}
}catch(Exception e){
e.printStackTrace();
}
}
});
}
I modified above method to avoid that crash but I'm unable to reproduce this issue and so unable to test this. Can you guys check this change in your code and confirm if this is the working fix for you or not?
Hi, dhavalwooplr
Crash issue is fixed by changing to your code above, but we can't show the tutorial [Spotlight View ] again if we use the above code....
Crash issue was found when :
- A spotlight view tutorial is being displayed in screen, user exits the app by calling finish (). -Next time when app open's crash report :
Fatal Exception: java.lang.IllegalStateException: Cannot start this animator on a detached view! at android.view.RenderNode.addAnimator(RenderNode.java:812) at android.view.RenderNodeAnimator.setTarget(RenderNodeAnimator.java:300) at android.view.RenderNodeAnimator.setTarget(RenderNodeAnimator.java:282) at android.animation.RevealAnimator.<init>(RevealAnimator.java:37) at android.view.ViewAnimationUtils.createCircularReveal(ViewAnimationUtils.java:55) at com.wooplr.spotlight.SpotlightView.startRevealAnimation(SpotlightView.java:358) at com.wooplr.spotlight.SpotlightView.access$100(SpotlightView.java:54) at com.wooplr.spotlight.SpotlightView$1.run(SpotlightView.java:319) at android.os.Handler.handleCallback(Handler.java:746) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5443) at java.lang.reflect.Method.invoke(Method.java)
What i have done to avoid crash
-
Modified SpotlightView.java with your code below `SpotlightView.this.post(new Runnable() { @Override public void run() { try{ boolean isAttachedToWindow = true; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { isAttachedToWindow = SpotlightView.this.isAttachedToWindow(); }
if(isAttachedToWindow) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (isRevealAnimationEnabled) startRevealAnimation(activity); else { startFadinAnimation(activity); } } else { startFadinAnimation(activity); } } }catch(Exception e){ e.printStackTrace(); } } });`
Issue facing now
- I used to show the tutorial again by clearing Shared preference values in a Method.
- Now the tutorial cant be shown again , if i use your code above.
Please help me in fixing this
Is it solved? Its gonna 1 year. Issue still exists