Is there a way to get a button to vibrate but only when the if condition is verified?
Here's the code:
Vibrator vibe = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE) ;
if(l2>=l1){
insertactone.setBackgroundColor(Color.RED);
};
here is the onclick method for insertactone:
einsertactone = (Button) findViewById(R.id.bsqlinsertactone);
insertactone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.bsqlinsertactone:
insertactoneClick();
break;
}
}
private void insertactoneClick() {
startActivity(new Intent(
"com.example.everydaybudgetplanner.ACTONESQLENTRY"));
}
});
I want it to vibrate only if the the IF condition is verified.