Skip to content

Commit

Permalink
解决Android 7.1.1起不能再用Toast的问题(先解决crash)
Browse files Browse the repository at this point in the history
  • Loading branch information
bihe0832 committed Dec 8, 2016
1 parent 5d6dbaf commit d3a17cd
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,15 @@ public void show() {

int flags = 0;
int type = 0;


if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
type = WindowManager.LayoutParams.TYPE_TOAST;
//解决Android 7.1.1起不能再用Toast的问题(先解决crash)
if(Build.VERSION.SDK_INT > 24){
type = WindowManager.LayoutParams.TYPE_PHONE;
}else{
type = WindowManager.LayoutParams.TYPE_TOAST;
}
} else {
type = WindowManager.LayoutParams.TYPE_PHONE;
}
Expand Down

1 comment on commit d3a17cd

@xiaomingtuo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

android o 会crash,使用TYPE_TOAST不会;Oppo 7.1.1 TYPE_TOAST没有crash

Please sign in to comment.