This article we enter the Android multi-function clock development combat learning, the specific effect can refer to the phone on the clock, the contents are as followsFirst, let's take a look at the layout file Layout_main.xml
Entire layout:
The whole layout is a framelayout, we put a tabhost in it, then we can add directly to the inside of the layout
Reference: http://developer.android.com/reference/android/os/SystemClock.htmlsystem.currenttimemills () the number of milliseconds that this function obtains is determined by the date and time of the current system. It can be changed by Systemclock.setcurrenttimemillis (). If you need an accurate timer, you must not use it .Systemclock.uptimemillis () This clock is often used to animate, and Animationutils.
Recently, I implemented a function in android. I drew a simulated hour hand in the activity and touched the hour hand and minute hand to adjust the time.
In fact, it was quite simple to start with, but it took me nearly a week to implement it all...
1. Draw a clock in the activity. Sometimes the needle is followed by a split needle and the code is omitted.
The dial, hour hand, and minute hand are both image
Turn on call setup Video call "Wait";Step 1: The test machine and the matching machine A in the video call process;Step 2: Match machine B to test machine outbound video call;Step 3: Test machine to answer the video call with the machine B;Phenomenon: Video calls after a few seconds of their own initiative to break offLocate the file Alps/packages/apps/phone/src/com/mediatek/phone/vt/vtincallscreen.java,Find function Internalanswervtcallpre (),For exa
code.Package Com.yung.timebutton;import Java.util.hashmap;import Java.util.map;import java.util.timer;import Java.util.timertask;import Android.annotation.suppresslint;import Android.content.context;import Android.os.bundle;import Android.os.handler;import Android.util.attributeset;import Android.util.Log;import Android.view.view;import Android.view.view.onclicklistener;import android.widget.button;/** * Given the frequent use of the Get Verification Code countdown button On the interne
Turn on call setup Video call "Wait";Step 1: The test machine and the match machine A are in the video call process;Step 2: Match machine B to the test machine outbound video calls;Step 3: Test the machine to answer the video call of the match machine B;Phenomenon: Video calls are automatically broken after a few secondsLocate the file Alps/packages/apps/phone/src/com/mediatek/phone/vt/vtincallscreen.java,Find function Internalanswervtcallpre (),The following two lines are:Vtincallscreenflags.ge
Code Changes the worldAndroid automatically shuts down after a few seconds dialogAlertdialog.builder Builder = new Alertdialog.builder (V.getcontext ()); Builder.settitle ("Sent successfully! "); Builder.setmessage ("Auto-off after 2 seconds!") "); Builder.setcancelable (true); Final Alertdialog dlg = Builder.create (); Dlg.show ();
Table Clock (AnalogClock)Java.lang.Object;Android.view.View;Android.widget.AnalogClock;AnalogClock class methodAnalogClock ExampleComplete project: http://download.csdn.net/detail/sweetloveft/9416138This program as long as the map can be, recall before the DigitalClock, and later verified that this kind of engineering is generally a map, not to self-painted words, need to do related rewriting of derived classes, which will be used to Canvas and other
Digital Clock (DigitalClock)Java.lang.Object;Android.view.View;Android.widget.TextView;Android.widget.DigitalClock;DigitalClock class methodWatermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /center ">DigitalClock Demo sampleFull project:http://download.csdn.net/detail/sweetloveft/9413393You just need to map it in XML! Note The Textclock override is used in the high version number1.mainactivi
alarm clock) pendingintent PaIn Tent = Pendingintent.getactivity (Mainactivity.this, 1, New Intent (Mainactivity.this,secondactivity.class), Pen
Dingintent.flag_update_current); @Override public void Ontimeset (timepicker view, int hourofday, int minute) {//Set the time of your choice C.set (Calendar.
Hour_of_day, Hourofday);
C.set (Calendar.minute, MINUTE); The first parameter specifies the type of alarm service//second parameter sp
Multi-sum thinking, code farmers are not API callersProgress record:ListView Display Alarm Database completeAlarm to be completed when alertWork today:Implementing Alarm bellsEclipse Shortcut: ALT + ALT + upper Next (upper) side new blank lineCtrl + Alt + up or down to copy the previous line (in the context of the Win7 desktop shortcut), right-click on the desktop. Graphics Options-Shortcut-disabledWin7 Android API does not display properly after open
Android automatically shuts down after 5 seconds of Power disconnection
Recently, I am working on a car recorder. Because the lithium battery capacity on the on-board equipment is relatively small, I need to shut down automatically after I stop the device and save the data. Because the Shutdown permission is not open to common applications, therefore, you need to compile the code in the source code. You can
"White-space:pre" > /Implementation Wait a few seconds after the jump, method one New Handler (). postdelayed (new Runnable () {@OverridePublic void Run () {Intent Intent = new Intent (mainactivity. This, Exampleactivity.class); StartActivity (Intent);}}, Splash_display_lenght);Implementation wait a few seconds after the jump, method twoFinal Intent localintent = new Intent (This, exampleactivity. Class);
(Calendar.month)) +1; //days of the current month: Current day intDay_of_month = Cal.Get(Calendar.day_of_month); //Current time: Hour_of_day-24 hour system; HOUR-12 hour system inthour = Cal.Get(Calendar.hour_of_day); //Current points intminute = Cal.Get(Calendar.minute); //Current seconds intSecond = Cal.Get(Calendar.second); //0-morning; 1-PM intAMPM = Cal.Get(CALENDAR.AM_PM); //the first week of the current year
system will not enter sleep phenomenonRefer to the following method to have the dialog box appear above the lock screenThe OnCreate method is usedRequestwindowfeature (Window.feature_no_title); Hide TitleWindow win = GetWindow ();Windowmanager.layoutparams winparams = Win.getattributes ();Winparams.flags |= (WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED| WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON| WindowManager.LayoutParams.FL
Android-interaction instance (clock) between sub-thread and main thread)
The. xml Code is as follows:
The. java program code is as follows:
Package org. lxh. demo; import java. util. date; import java. text. simpleDateFormat; import android. app. activity; import android. OS. bundle; import
the whole application talk about already almost, after this article, I will upload source to resources, like can download and learn, today, the alarm clock start setting, set page loadingIn Android, the alarm and wake functions are controlled and managed by the Alarm Manager service. We are familiar with the RTC alarm clock and timer have a great relationship wit
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.