getActivity / Toaster

Android 吐司框架,专治 Toast 各种疑难杂症
Apache License 2.0
3.25k stars 406 forks source link

小米机型,android 11报错 #76

Closed JackLiaoJH closed 3 years ago

JackLiaoJH commented 3 years ago

ava.lang.IllegalArgumentException View=android.widget.TextView{23328a V.ED..... ......ID 0,65-776,197 #7f09075f app:id/tv_content} not attached to window manager

android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:572) 2 android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:476) 3 android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:139) 4 android.widget.ToastPresenter.show(ToastPresenter.java:207) 5 android.widget.Toast$TN.handleShow(Toast.java:810) 6 android.widget.Toast$TN$1.handleMessage(Toast.java:742) 7 android.os.Handler.dispatchMessage(Handler.java:106) 8 android.os.Looper.loop(Looper.java:236) 9 android.app.ActivityThread.main(ActivityThread.java:8061) 10 java.lang.reflect.Method.invoke(Native Method) 11 com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656) 12 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)

getActivity commented 3 years ago
JackLiaoJH commented 3 years ago

最新版本,没有调用ToastUtils.setStrategy,目前发现的全是小米手机,android11,线上问题,我们这边也复现不了。不知道只跟android11 小米有关?

getActivity commented 3 years ago

小伙子,如果你没有复现步骤,我就没办法排查到具体原因,更没办法帮你做修复的。

getActivity commented 3 years ago

目前的崩溃情况是什么样?崩溃次数和用户数分别是多少?

getActivity commented 3 years ago
public void show(View view, IBinder token, IBinder windowToken, int duration, int gravity,
        int xOffset, int yOffset, float horizontalMargin, float verticalMargin,
        @Nullable ITransientNotificationCallback callback) {
    checkState(mView == null, "Only one toast at a time is allowed, call hide() first.");
    mView = view;
    mToken = token;

    adjustLayoutParams(mParams, windowToken, duration, gravity, xOffset, yOffset,
            horizontalMargin, verticalMargin);
    if (mView.getParent() != null) {
        mWindowManager.removeView(mView);
    }
    try {
        mWindowManager.addView(mView, mParams);
    } catch (WindowManager.BadTokenException e) {
        return;
    }
}
public class BlackToastStyle implements IToastStyle<TextView> {

    @Override
    public TextView createView(Context context) {
        TextView textView = new TextView(context);
        .....
        return textView;
    }
}
JackLiaoJH commented 3 years ago

还蛮多,是单列,view是存储在单列中,好的,那我再看看,谢谢!

getActivity commented 3 years ago

如果你们那么写,那不是框架的问题了,就是你们自己的问题了

getActivity commented 3 years ago

小伙子,你看看这边还有其他问题不,没有的话我就关闭 issue 了。