Are you using the Command framework, or just SampleRobot?
If you are using commands, I would create a Command with a 100 ms timeout, which would open the solenoid in the initialize() method, and close it in the end() method.
If you are just using a simple teleop loop, then it is a little more complicated. Here is some psuedo code that should give you an idea of how to do it:
Code:
// Class variables (their values must persist between iterations of the loop)
boolean solenoidOpen = false;
long solenoidOpenTime;
// Runs on each iteration of the teleop loop
if (!solenoidOpen) {
if(solenoidShouldBeTriggered) {
openSolenoid();
solenoidOpened = true;
solenoidOpenTime = System.currentTimeMillis();
}
} else {
if (System.currentTimeMillis() - solenoidOpenTime > 100) {
closeSolenoid();
solenoidOpen = false;
}
}
If you want more clarification, just ask.