Java implements the dynamic clock and sets the alarm function, java Dynamic clock alarm
The example in this article shares with you the java function for implementing the dynamic clock setting function for your reference. The details are as follows:
Shows the dynamic
1. We enter the Samsung mobile phone's desktop, and then find the "Application" on the desktop.
2. In the application will see a "clock" icon, we click on the clock to enter, as shown in the following figure.
3. Then in the alarm clock, you will see an "Alarm
return.
Note: Multiple cities can be set.
4, use the timer.
Click on " timer "-->"new" --> set time--> start, timer start countdown.
Note: You can set values for hours, minutes, and seconds, respectively.
5, Timer countdown to the end of the screen in the lower right corner pop-up reminders, display this timer information, and provide "Dismiss" (cancel) button.
6, use the stopwatch.
Click the "stopwatch" -
In the last article, we introduced how to make a digital clock, today I would like to introduce in this article in the digital clock on the basis of an increase in the set alarm bell function. The HTML5 audio element is used in this article to invoke the Bell audio.
Want to extend the effect of the alarm
, and open the link Properties panel to create a sound identifier for the "timekeeping sound."
3. Click the 1th frame of the code layer, open the Actions panel, and enter the following code.
Declaring a Sound ObjectGugu = new Sound ();Attach the timekeeping sound to the new objectGugu.attachsound ("timekeeping sound");if (seconds = = 0 minutes = 0) {Gugu.start ();}
With the above code, when the whole point of the hour, the hour the sound will ring.
E
= "alarm_action ";
Intent intenttofire = new intent (alarm_action );
Pendingintent = pendingintent. getbroadcast (this, 0, intenttofire, 0 );
Alarms. Set (alarmtype, timeorlengthofwait, pendingintent );
When alarm arrives, the pendingintent you specified will be triggered. Set another alarm and use the same pendingintent to replace the existing alarm.
Cancel a
table and saves some of the information needed to create the alarm in the database.1 Public classBootreceiverextendsbroadcastreceiver{2 @Override3 Public voidOnReceive (Context context, Intent Intent) {4arraylistgetallalarms (context);5 for(Alarm alarm:alarms) {6 //Test7 //when restarted, all should be restored, and if this is a timed task, then just restore the month
Use of Android alarm clock AlarmManager
AlarmManager Introduction
AlarmManagerThis class provides access interfaces for the system alarm service.
You can set a wake-up function for your application at a certain time in the future.
When the alarm goes off, it is actuallyThe system sends a broadcast for the alarm.The t
, to set a recurring alarm that wakes up every 21:30: private static final int INTERVAL = $ * * 24;//24h//... Intent Intent = new Intent (context, requestalarmreceiver.class); Pendingintent Sender = Pendingintent.getbroadcast (context, request_code, intent, Pendingintent.flag_cancel_ current); Schedule the alarm! Alar
.
Step 30 creates a 20px positive circle that fills a graphic with the same gradient.
Then in the gradient panel, change the first color block to bright gray, the second to Gray, the third to dark Gray, and the fourth to Gray. (same as the second one)
Vertically fills a gradient to the new shape.
Step 31 creates a rectangle with a 8px width and 45px height. Fills a linear gradient.
Then in the
step, the screen will be out of specific time, small series is mainly to remind the NAP, keep the spirit, choose 12:30.
Eighth step, this time, the interface as shown, we want to have the alarm clock, so, choose "Start Program."
The Nineth step, then, will let you select the program, we can click "Browse" to find Windows Media Player or
Timepickerdialog.ontimesetlistener ( {public void Ontimeset (Timepicker timepicker, int hourofday,int minute) {Calendar c=calendar.getinstance () ;//Get Date Object C.settimeinmillis (System.currenttimemillis ()); Sets the Calendar object C.set (Calendar.hour, hourofday); Set Alarm hours c.set (Calendar.minute, MINUTE); Set the alarm number of minutes c.s
1. Under the Standby page, click "Application".
2. Slide the screen and click on the "clock".
3. Click on "Alarm Clock".
4. Click "Create Alarm Clock".
5. Set your alarm
1. Under the Standby page, click "Application".
2. Click on "Clock".
3. Click on the "Alarm Clock" icon in the upper left corner of the screen.
4. Select "Create Alarm Clock".
5. Set the alarm
DateTime a = datetime.now;//Gets the time of the computer nowDateTime NZ = convert.todatetime ("2015-4-14 22:44");//define the time of the alarmwhile (true){A = a.addminutes (1); Display time, one minute plus one minute displayConsole.WriteLine (A.toshorttimestring ());//output Display alarm timeif (NZ. Toshorttimestring (). Equals (A.toshorttimestring ()))//If the alarm time is now time,{Console.WriteLine
#filename my little alarm clock.Import timeImport SysImport WinSoundA=time.ctime ()Print ("***************** Pro is Now", A, "**********************")Print ("*********************** welcome you to use Shup DIY alarm Clock applet ***********************")Hour1=int (Input ("*****************", enter the hour you want to set the
static void Main (string[] args){DateTime dt = DateTime.Now;Console.WriteLine (DT);DateTime NZ = convert.todatetime ("2015-4-2 17:00");//Convert NZ time to the time the computer can recognizefor (int i = 1; i {DT = dt.AddMinutes (1); System time plus 1 minutesConsole.WriteLine (dt. Toshorttimestring()); //Output time for a short time, that is, only time, no date if (NZ. Toshorttimestring (). Equals (dt. Toshorttimestring ()))//Two time compared to the formula!! This is equal to the formula equal
}}is the TimerTask class, in the package: import Java.util.TimerTask. The consumer inherits the class and implements the public void run () method to encapsulate the task to be run into its run method. Because the TimerTask class implements the Runnable interface.
Timer class: Set the parameters of the timer, including the start time, interval time, time delay, details see schedule method.
Note: The same TimerTask object cannot be added to the timer twice, and if you have more than
static void Main (string[] args){DateTime dt = DateTime.Now; Get PC Current TimeDateTime NZ = convert.todatetime ("2015-4-13 17:00");while (true){DT = dt. AddMinutes (1); Every minute and a minute plusif (NZ. Toshorttimestring (). Equals (dt. Toshorttimestring ()))//When the computer time equals the alarm time{Console.WriteLine (dt + "Jingle Bell, Jingle Bell, Jingle Bell");Console.Write ("Do you want to turn off the
First, look at the effect of the alarm clock page
Features to implement:
1: Turning pictures According to weather conditions change
2: Turning time can be set, the end of rotation, alarm sound on the end
3: Aperture Color Gradient effect
Directly on the code:
Package Com.yuekong.sirius.extension.customview;
Import Android.animation.Animator;
Import
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.