I have no idea how to do this. What I'm doing is constructing a float value based on the time of day in this format: HH.MMSS.
That bit I've worked out. However second(), minute(), and hour(), will return single digits for 0–9. I would like to change that to 00–09.
I've been trying to get java.text.DecimalFormat() to do the trick and it works in some instances but when I combine everything into one float it just drops all the zeros. Here's my example code.
import java.text.DecimalFormat;
DecimalFormat df = new java.text.DecimalFormat("00");
void draw() {
background(204);
float s = second();
float m = minute();
float h = hour();
float f = float(df.format(h) + "." + df.format(m) + df.format(s));
// println(df.format(h)); // WORKS
// println(df.format(m)); // WORKS
// println(df.format(s)); // WORKS
println(df.format(f)); // DOES NOT WORK
}
Any advice would be fantastic. Thanks all!
Cheers,
Derek.
—
Derek J. Kinsman, creative technologist.
@ghostpressbed
Not sure if this has been posted. I dug around and couldn't find anything, so, apologizes if it has been and I missed it.
I get an error when trying to do any Processing Android work on the Galaxy Nexus & Android 4.0. I've already checked to make sure the Android SDK is up to date as far as 4.0 dev goes and can successfully compile a generic hello world from Eclipse (not Processing, just demo/examples from Android).
This is the error that Processing 2.0a4 provides. The current stable release (1.5.1) also has a Lost Connection error. I don't think it has anything to do with my code. Examples from the Ketai library and Jer Thorp's Getting Started example doesn't run either.