This works: Thread.Sleep(1000)
This does not work: Thread.Sleep(frequency)
The frequency variable takes edittext
input from a user and parses it into an integer so it should pass just fine. I have no idea what I'm doing wrong. Help appreciated :)
private void FlashButtonClicked() {
startPattern = true;
try{
frequency = Long.parseLong(frequencyInput.getText().toString());
}catch(NumberFormatException e){
Toast.makeText(getBaseContext(), "value not acceptable", Toast.LENGTH_LONG).show();
}
frequency = (1 / frequency) * 1000;
while(startPattern){
enableTorch();
try{
// see if you can figure out why I can't pass the user input into the
//Thread.sleep() method without it fucking up. When you change it manually with
// a long input, it works just fine.
Thread.sleep(frequency);
}catch(Exception e){
e.printStackTrace();
}
}
}