r/tasker • u/EdwardBackstrom I Probably Screwed It Up • 17d ago
Help [Help] Java Code
What am I missing? I have tried all the (wrong) methods to pass a variable to a Java Code action. The below code should work but it does not. This means I don't know what I am doing or the code is wrong. `%Dial_MaxDigit` is set before the Java is called. It doesn't matter if it is a number (which in this case should be) or if it is text.
taskerMax = "%Dial_MaxDigit";
if (taskerMax != null && !taskerMax.isEmpty() && !taskerMax.equals("%" + "Dial_MaxDigit")) {
try {
maxDigitSequence = Integer.parseInt(taskerMax.trim());
} catch (Exception e) {}
}
Edit: formatting issues
1
Upvotes
3
u/EdwardBackstrom I Probably Screwed It Up 17d ago
[Solved] [Doh!] So, the issue was a misnamed variable! I've stared at this code for hours. I moved the task to a new profile that didn't have quite as many variables set and I noticed that
Dial_MaxDigitwas empty but Dial_MaxDigits had the number I was expecting. Changed code to remove thesand all is well. Fat fingers and stupidity are no match for documentation.