大于两个的if分支,使用switch
This commit is contained in:
@ -56,12 +56,16 @@ public class CropImageActivity extends BaseActivity {
|
||||
private Handler handler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
if (msg.what == 0) {
|
||||
toast("上传成功");
|
||||
} else if (msg.what == 1) {
|
||||
toast("上传失败");
|
||||
} else if (msg.what == 2) {
|
||||
toast("修改太频繁,请稍后再试");
|
||||
switch (msg.what) {
|
||||
case 0:
|
||||
toast("上传成功");
|
||||
break;
|
||||
case 1:
|
||||
toast("上传失败");
|
||||
break;
|
||||
case 2:
|
||||
toast("修改太频繁,请稍后再试");
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user