Skip to content
This repository has been archived by the owner on Jun 30, 2024. It is now read-only.

Does not work with Android O #108

Open
alexeyvasilyev opened this issue Mar 23, 2017 · 3 comments
Open

Does not work with Android O #108

alexeyvasilyev opened this issue Mar 23, 2017 · 3 comments

Comments

@alexeyvasilyev
Copy link

alexeyvasilyev commented Mar 23, 2017

Toasts crashed if the project is targeting Android O.

com.github.johnpersano.supertoasts.demo E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                       Process: com.github.johnpersano.supertoasts.demo, PID: 6077
                                                                                       android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
                                                                                           at android.view.ViewRootImpl.setView(ViewRootImpl.java:760)
                                                                                           at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:356)
                                                                                           at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:92)
                                                                                           at com.github.johnpersano.supertoasts.library.Toaster.displaySuperToast(Toaster.java:186)
                                                                                           at com.github.johnpersano.supertoasts.library.Toaster.handleMessage(Toaster.java:136)
                                                                                           at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                           at android.os.Looper.loop(Looper.java:156)
                                                                                           at android.app.ActivityThread.main(ActivityThread.java:6440)
                                                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                                                           at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:746)

To reproduce recompile demo with following and run on emulator

    compileSdkVersion 'android-O'
    buildToolsVersion '26.0.0-rc1'
    minSdkVersion 16
    targetSdkVersion 'O'
@lambed
Copy link

lambed commented Dec 12, 2017

After year so using SuperToast I am now having the same problem when my project is using O. Any suggestions would be greatly appreciated.

@lockeb
Copy link

lockeb commented Dec 28, 2017

In the same position. Doesn't look like this library is going to be fixed so I switched to https://github.com/Muddz/StyleableToast. It works almost the same and is compatible with Android O.

@MatheusDinni
Copy link

I had the same issue. Just use SuperActivityToast instead of SuperToast and it works fine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants