Blankj / AndroidUtilCode

:fire: Android developers should collect the following utils(updating).
https://blankj.com/2016/07/31/android-utils-code/
Apache License 2.0
33.32k stars 10.69k forks source link

ToastUtils BUG #618

Closed atoliu closed 6 years ago

atoliu commented 6 years ago

ToastUtils 在Redmi 5A 上无法显示

版本1.19.4

Redmi 5A

API 25 Android 7.1.2

为什么对 25 做特殊处理 if (Build.VERSION.SDK_INT == Build.VERSION_CODES.N_MR1) { try { //noinspection JavaReflectionMemberAccess Field field = View.class.getDeclaredField("mContext"); field.setAccessible(true); field.set(sToast.getView(), new ApplicationContextWrapperForApi25()); } catch (Throwable throwable) { throwable.printStackTrace(); } } 这段代码 导致 需要悬浮窗 权限

Blankj commented 6 years ago

android api 25 的 bug 这是,需要 try catch,某些机型需要悬浮窗权限