0% found this document useful (0 votes)
19 views4 pages

7 StopWatch

The document outlines the development of a Stop Watch Application using Flutter, including the design code in XML and the Java program for functionality. It features a user interface with buttons for start, stop, and reset, along with a chronometer display. The application is successfully designed and developed as per the specifications provided.

Uploaded by

Akash Patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views4 pages

7 StopWatch

The document outlines the development of a Stop Watch Application using Flutter, including the design code in XML and the Java program for functionality. It features a user interface with buttons for start, stop, and reset, along with a chronometer display. The application is successfully designed and developed as per the specifications provided.

Uploaded by

Akash Patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Experiment – 7

Aim  Develop a Stop Watch Application using Flutter.

Designer Code

<RelativeLayout
android:gravity="center"
android:background="@drawable/background1"

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="STOP WATCH APP !"
android:background="#FF9800"
android:id="@+id/heading"
android:textSize="35dp"
android:textStyle="bold"
android:textAlignment="center"
android:layout_margin="35dp"
android:padding="10dp"
/>
<Button
android:id="@+id/btnstart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="START"
android:layout_centerHorizontal="true"
android:layout_below="@+id/heading"
android:layout_margin="10dp"
android:textSize="25dp"
android:padding="10dp"
/>
<Button
android:id="@+id/btnstop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="STOP"
android:layout_centerHorizontal="true"
android:layout_below="@+id/btnstart"
android:layout_margin="10dp"
android:textSize="25dp"
android:padding="10dp"
/>
<Button
android:id="@+id/btnreset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RESET"
android:layout_centerHorizontal="true"
android:layout_below="@+id/btnstop"
android:layout_margin="10dp"
android:textSize="25dp"
android:padding="10dp"
/>
<Chronometer
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chronometer"
android:textSize="23dp"
android:layout_below="@id/btnreset"
android:layout_centerHorizontal="true"
android:gravity="center"
android:textColor="@color/white"
android:background="#E91E63"
android:layout_margin="10dp"
android:padding="10dp"
/>
</RelativeLayout>
JAVA PROGRAM 

public class MainActivity extends AppCompatActivity {


Button start,stop,reset;
Chronometer chronometer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_main);
start = (Button) findViewById(R.id.btnstart);
stop = (Button) findViewById(R.id.btnstop);
reset = (Button) findViewById(R.id.btnreset);
chronometer = (Chronometer) findViewById(R.id.chronometer);

// start.setOnClickListener(V-> chronometer.start());
//stop.setOnClickListener(V-> chronometer.stop());

start.setOnClickListener(V-> {

chronometer.setBase(SystemClock.elapsedRealtime());
chronometer.start();
});

stop.setOnClickListener(V->chronometer.stop());

reset.setOnClickListener(V->
chronometer.setBase(SystemClock.elapsedRealtime()));

}
}
Program Output 

Result  Stop watch Application designed and developed.

You might also like