MAD Project
MAD Project
MAD Project
Sr.
No. Characteristic to Poor Average Good Excellent
beassessed (Marks 1- (Marks 4- (Marks 6 (Marks 9-
3) 5) - 10)
8)
(A) Process and Product Assesssment (Convert above total marks out of 6 marks)
1 Relevance to the Course
Literature Survey /
2 Information Collection
Completion of the Target
3 as per project proposal
Analysis of data and
4 representation
5 Quality of Prototype /
Model
6 Report Preparation
(B) Individual Presentation / Viva (Convert above total marks out of 4 marks)
8 Presentation
9 Viva
Micro – Project Evaluation Sheet:
Comments / Suggestions about team work / leadership / inter – personal communication (if
MICRO PROJECT
Academic year: 2023-24
TITLE OF PROJECT
Stopwatch Application
22617
2
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
CERTIFICATE
This is to certify : Nikam Tejaswini Nitin
Place: CHANDWAD
Date: / 03 /2024
3
INDEX
Part B
4
PART A-Plan
A stopwatch is a timepiece designed to measure the amount of time that elapses between
its activation and deactivation. A large digital version of a stopwatch designed for
viewing at a distance, as in a sports stadium, is called a stop clock. In manual timing, the
clock is started and stopped by a person pressing a button. In fully automatic time, both
starting and stopping are triggered automatically, by sensors. The timing functions are
traditionally controlled by two buttons on the case. Pressing the top button starts the timer
running, and pressing the button a second time stops it, leaving the elapsed time
displayed. A press of the second button then resets the stopwatch to zero. The second
button is also used to record split times or lap times. When the split time button is pressed
while the watch is running it allows the elapsed time to that point to be read, but the
watch mechanism continues running to record total elapsed time. Pressing the split button
a second time allows the watch to resume display of total time.
5
4.0 Action Plan-
Planned Planned
Sr no. Details of activity Start Date Finish Date
6
PART B-Plan
A stopwatch is a timepiece designed to measure the amount of time that elapses between its
activation and deactivation.
The layout defines three buttons that we will use to control the stopwatch. Each button uses
its onClick attribute to specify which method in the activity should run when the button is
clicked. When the Start button is clicked, the onClickStart() method gets called, when the
Stop button is clicked the onClickStop() method gets called, and when the Reset button is
clicked the onClickReset() method gets called. We will use these methods to start, stop and
reset the stopwatch.
We will update the stopwatch using a method we will create called runTimer(). The
runTimer() method will run code every second to check whether the stopwatch is running,
and, if it is, increment the number of seconds and display the number of seconds in the text
view.
To help us with this, we will use two private variables to record the state of the stopwatch.
We will use an int called seconds to track how many seconds have passed since the stopwatch
started running, and a boolean called running to record whether the stopwatch is currently
running.
We will start by writing the code for the buttons, and then we will look at the runTimer()
method.
Add code for the buttons When the user clicks on the Start button, we will set the
running variable to true so that the stopwatch will start. When the user clicks on the
Stop button, we will set running to false so that the stopwatch stops running. If the
user clicks on the Reset button, we will set running to false and seconds to 0 so that
the stopwatch is reset and stops running.
The runTimer() method The next thing we need to do is to create the runTimer()
method. This method will get a reference to the text view in the layout; format the
contents of the seconds variable into hours, minutes, and seconds; and then display
the results in the text view. If the running variable is set to true, it will increment the
seconds variable.
7
Handlers allow you to schedule code A Handler is an Android class you can use to
schedule code that should be run at some point in the future. You can also use it to
post code that needs to run on a different thread than the main Android thread. In our
case, we are going to use a Handler to schedule the stopwatch code to run every
second. To use the Handler, you wrap the code you wish to schedule in a Runnable
object, and then use the Handle post() and postDelayed() methods to specify when
you want the code to run.
The post() method The post() method posts code that needs to be run as soon as
possible(which is usually immediately). This method takes one parameter, an object
of type Runnable. A Runnable object in Androidville is just like a Runnable in plain
old Java: a job you want to run. You put the code you want to run in the Runnable’s
run() method, and the Handler will make sure the code is run as soon as possible.
The postDelayed() method The postDelayed() method works in a similar way to the
post() method except that you use it to post code that should be run in the future. The
postDelayed() method takes twoparameters:a Runnable and a long.
8
4.0 Actual Methodology/Procedure Followed:
Program Code:-
String.xml
<resources>
<string name=”app_name”>ProjectGurukul Stopwatch</string>
<string name=”start”> Start </string>
<string name=”reset”> Reset </string>
<string name=”stop”> Stop </string>
</resources>
Border.xml
MainActivity.java
Package com.prabhu.projectgurukulstopwatch;
Import android.os.Bundle;
Import android.app.Activity;
Import android.os.Handler;
Import android.view.View;
Import java.util.Locale;
Import android.widget.TextView;
@Override
Protected void onCreate(Bundle savedInstanceState)
{
Super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState != null) {
sec = savedInstanceState.getInt(“seconds”);
is_running = savedInstanceState.getBoolean(“running”);
was_running = savedInstanceState .getBoolean(“wasRunning”);
}
Running_Timer();
}
9
@Override
Public void onSaveInstanceState(
Bundle savedInstanceState)
{
savedInstanceState.putInt(“seconds”, sec);
savedInstanceState.putBoolean(“running”, is_running);
savedInstanceState.putBoolean(“wasRunning”, was_running);
}
@Override
Protected void onPause()
{
Super.onPause();
Was_running = is_running;
Is_running = false;
}
@Override
Protected void onResume()
{
Super.onResume();
If (was_running) {
Is_running = true;
}
}
Handle.post(new Runnable() {
@Override
10
Int mins = (sec % 3600) / 60;
Int secs = sec % 60;
secs); T_View.setText(time_t);
If (is_running) {
Sec++;
}
Handle.postDelayed(this, 1000);
}
});
}
}
Activity.xml
<TextView
Android:id=”@+id/textView1”
Android:layout_width=”306dp”
Android:layout_height=”wrap_content”
Android:layout_x=”38dp”
Android:layout_y=”41dp”
Android:text=”Stopwatch”
Android:textAlignment=”center”
Android:textColor=”#0CDCEF”
Android:textSize=”@android:dimen/app_icon_size” />
<TextView
Android:id=”@+id/timeview2”
Android:layout_width=”230dp”
Android:layout_height=”wrap_content”
Android:layout_marginTop=”100dp”
Android:layout_x=”52dp”
Android:layout_y=”204dp”
Android:textAppearance=”@android:style/TextAppearance.Large”
Android:textColor=”#125BEC”
Android:textSize=”50dp” />
11
<Button
Android:id=”@+id/start_button”
Android:layout_width=”127dp”
Android:layout_height=”wrap_content”
Android:layout_x=”50dp”
Android:layout_y=”404dp”
Android:onClick=”onClickStart”
Android:text=”@string/start”
Android:textColor=”@color/white”
Tools:ignore=”DuplicateClickableBoundsCheck,DuplicateClickableBoundsCheck” />
<Button
Android:id=”@+id/stop_button”
Android:layout_width=”141dp”
Android:layout_height=”wrap_content”
Android:layout_x=”215dp”
Android:layout_y=”404dp”
Android:onClick=”onClickStop”
Android:text=”@string/stop”
Android:textColor=”@color/white” />
<Button
Android:id=”@+id/reset_button”
Android:layout_width=”127dp”
Android:layout_height=”wrap_content”
Android:layout_x=”149dp”
Android:layout_y=”518dp”
Android:onClick=”onClickReset”
Android:text=”@string/reset”
Android:textColor=”@color/white”
Android:visibility=”visible” />
<TextView
Android:id=”@+id/textView3”
Android:layout_width=”wrap_content”
Android:layout_height=”wrap_content”
Android:layout_x=”24dp”
Android:layout_y=”598dp”
Android:textColor=”#FF0000”
Android:text=”InstructionsFor New User)”
Tools:ignore=”DuplicateIds,HardcodedText” />
<TextView
Android:id=”@+id/textView4”
Android:layout_width=”wrap_content”
Android:layout_height=”wrap_content”
Android:layout_x=”4dp”
Android:layout_y=”625dp”
Android:textColor=”@color/white”
Android:text=” 1. Press START Button to start the stopwatch.”
Tools:ignore=”HardcodedText” />
12
<TextView
Android:id=”@+id/textView5”
Android:layout_width=”wrap_content”
Android:layout_height=”wrap_content”
Android:layout_x=”21dp”
Android:layout_y=”651dp”
Android:textColor=”@color/white”
Android:text=” 2. Press STOP Button to stop the Stopwatch.”
Tools:ignore=”HardcodedText” />
<TextView
Android:id=”@+id/textView6”
Android:layout_width=”340dp”
Android:layout_height=”wrap_content”
Android:layout_x=”46dp”
Android:layout_y=”677dp”
Android:textColor=”@color/white”
Android:text=” 3. Press the RESET Button to restart your Stopwatch again.”
Tools:ignore=”HardcodedText” />
</AbsoluteLayout>
13
6.0 Output of the Micro-Project:-
14