For my app, I want a strobe light with multi colors to play, how do I do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want your screen to flash with different colors, that is just a matter of making a timer and having the main view change background colors every so often.
javax.swing.Timer can be used to change the screen every so often:
Where
TimeListenerwill be anActionListenerthat changes the background color of a specified activity. TimerListener could look like this:You’re gonna need to import javax.swing.Timer and ActionListener and ActionEvent are in java.awt.event.
If you’re using android however, you might want to consider using another class that is designed for android other than Timer. Timer is designed for swing and might not work well if you are using it on android. Any other timer like class will work similar to Timer though.