The alarm clock uses Android Studio A simple alarm clock designed for Android Phones APP
one , Introduce the design interface of the system

The alarm clock layout file code is as follows <?xml version="1.0" encoding="utf-8"?>

<TimePicker android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/timePicker"
android:layout_alignParentTop="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" /> <Button
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/alarm_state" android:layout_marginTop="5dp"
android:textSize="18dp" android:text="Start" android:id="@+id/alarm_on"
android:layout_alignParentLeft="true" android:layout_alignParentStart="true" />
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_below="@+id/alarm_state"
android:layout_marginTop="5dp" android:textSize="18dp" android:text="Stop"
android:id="@+id/alarm_off" android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" /> <TextView
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:paddingTop="10dp" android:textSize="25dp" android:text="Did you set the
alarm?" android:id="@+id/alarm_state" android:layout_below="@+id/timePicker"
android:layout_centerHorizontal="true" /> <Spinner
android:layout_width="match_parent" android:layout_height="wrap_content"
android:textSize="18dp" android:id="@+id/spinner"
android:layout_alignParentBottom="true" android:layout_centerHorizontal="true"
/> The stopwatch function contains four function keys , They are the beginning , suspend , Continue and reset . So we need four Button, Then you need three EditText Used to input hours, minutes and seconds to the user respectively . The specific codes are as follows :
<com.example.administrator.alarm5.TimerView
android:id="@+id/tabTimer"
android:layout_width=“match_parent”
android:layout_height=“match_parent”
android:orientation=“vertical”>

<EditText android:textAppearance="?android:attr/textAppearanceLarge"
android:id="@+id/etHour" android:inputType="number" android:singleLine="true"
android:layout_width="0dp" android:layout_weight="1"
android:layout_height="wrap_content" android:textAlignment="center"
android:textStyle="normal|bold" /> <TextView
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text=":" android:textAlignment="center" android:textStyle="normal|bold"
/> <EditText android:textAppearance="?android:attr/textAppearanceLarge"
android:id="@+id/etMin" android:inputType="number" android:singleLine="true"
android:layout_width="0dp" android:layout_weight="1"
android:layout_height="wrap_content" android:textAlignment="center"
android:textStyle="normal|bold" /> <TextView
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text=":" android:textAlignment="center" android:textStyle="normal|bold"
/> <EditText android:textAppearance="?android:attr/textAppearanceLarge"
android:id="@+id/etSec" android:inputType="number" android:singleLine="true"
android:layout_width="0dp" android:layout_weight="1"
android:layout_height="wrap_content" android:textAlignment="center"
android:textStyle="normal|bold" /> </LinearLayout> <LinearLayout
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/btnGroup" android:orientation="horizontal"> <Button
android:id="@+id/btnStart" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_weight="1"
android:text=" start " android:textAlignment="center" android:textSize="18sp" />
<Button android:id="@+id/btnPause" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_weight="1"
android:text=" suspend " android:textSize="18sp" android:textAlignment="center" />
<Button android:id="@+id/btnResume" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_weight="1"
android:text=" continue " android:textSize="18sp" android:textAlignment="center" />
<Button android:id="@+id/btnReset" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_weight="1"
android:text=" Reset " android:textSize="18sp" android:textAlignment="center" />
</LinearLayout> </com.example.administrator.alarm5.TimerView>

The last function item left is the timer , This is similar to the stopwatch mentioned above , different , advantage Button The button is used for timing , Another one is needed ListView Used to display the timing time , The detailed code is as follows :

<com.example.administrator.alarm5.StopWatchView
android:id="@+id/tabStopWatch"
android:layout_width=“match_parent”
android:layout_height=“match_parent”
android:orientation=“vertical”>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content" android:orientation="horizontal">
<TextView android:id="@+id/timeHour" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textAlignment="center" android:fontFamily="sans-serif"
android:textStyle="normal|bold" /> <TextView android:text=":"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textAlignment="center" android:textStyle="normal|bold" /> <TextView
android:id="@+id/timeMin" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textAlignment="center" android:textStyle="normal|bold" /> <TextView
android:text=":" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textAlignment="center" android:textStyle="normal|bold" /> <TextView
android:id="@+id/timeSec" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textAlignment="center" android:textStyle="normal|bold" /> <TextView
android:text=":" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textAlignment="center" android:textStyle="normal|bold" /> <TextView
android:id="@+id/timeMSec" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textAlignment="center" android:textStyle="normal|bold" />
</LinearLayout> <ListView android:layout_width="fill_parent"
android:layout_height="0dp" android:layout_weight="1"
android:id="@+id/lvWatchTimeList"
android:background="@color/common_google_signin_btn_text_dark_default">
</ListView> <LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content" android:orientation="horizontal"> <Button
android:layout_width="0dp" android:layout_height="wrap_content"
android:layout_weight="1" android:text=" start " android:id="@+id/btnSWStart"
android:textAlignment="center" android:textStyle="normal|bold"
android:textSize="18sp" /> <Button android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_weight="1"
android:text=" suspend " android:id="@+id/btnSWPause" android:textAlignment="center"
android:textSize="18sp" /> <Button android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_weight="1"
android:text=" continue " android:id="@+id/btnSWResume" android:textAlignment="center"
android:textSize="18sp" /> <Button android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_weight="1"
android:text=" Reset " android:id="@+id/btnSWReset" android:textSize="18sp"
android:textAlignment="center" /> <Button android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_weight="1"
android:text=" time " android:id="@+id/btnSWLap" android:textSize="18sp"
android:textAlignment="center" /> </LinearLayout>
</com.example.administrator.alarm5.StopWatchView>
The above basically describes the code of interface layout , These codes are activity_mian.xml Some codes in

Technology