如果输入了错误的密码,我正在尝试使编辑文本框振动并立即更改颜色
final Drawable oldBackground = findViewById(R.id.email).getBackground();
TimerTask timerTask = new TimerTask() {
@Override
public void run() {
MainActivty.this.findViewById(R.id.password).setBackground(oldBackground);
MainActivty.this.findViewById(R.id.email).setBackground(oldBackground);
}
};
Toast.makeText(MainActivty.this , valArray.get(0).toString(), Toast.LENGTH_SHORT).show();
findViewById(R.id.password).setBackgroundColor(Color.RED);
findViewById(R.id.email).setBackgroundColor(Color.RED);
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
v.vibrate(500);Timer timer = new Timer();
timer.schedule(timerTask, 1000);