0

I'm very new to programming and I'm making my first android app. I was wondering if there is a way to make the android phone vibrate when a number on the screen (used for keeping a count) reaches a certain value. Any help is much appreciated. Thanks!

 ...
  buttonplus.setOnClickListener(new View.OnClickListener() {
     @Override public void onClick(View v) {
        counter1++; 
        maincount.setText(Integer.toString(counter1));
        counter2--;
        cardsremain.setText(Integer.toString(counter2));
        counter3 = (counter1 * 10 / counter2);
        truecount.setText(Integer.toString(counter3));

I wish to vibrate the phone when the 3rd counter is a positive number

Markus Kauppinen
  • 3,025
  • 4
  • 20
  • 30
  • can you post the code which you are using to set number – kam1234 Nov 06 '19 at 03:53
  • buttonplus.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { counter1++; maincount.setText(Integer.toString(counter1)); counter2--; cardsremain.setText(Integer.toString(counter2)); counter3 = (counter1 * 10 / counter2); truecount.setText(Integer.toString(counter3)); I wish to vibrate the phone when the 3rd counter is a positive number – Steve Wozniak Nov 06 '19 at 04:07
  • Try to explain your situation more clearly, code you have written, if it doesn't work then why and things you have tried so far. – Sanil Khurana Nov 06 '19 at 04:11
  • The code I have provided is for a basic counting app. One number counts positively while one number counts negatively from a set value. A third number counts based on a mathematical division of the first and second number. I wish to have the device vibrate when the third number changes to a positive number. I have not tried anything so far as I'm not sure how to achieve this. – Steve Wozniak Nov 06 '19 at 04:25

0 Answers0