0% found this document useful (0 votes)
39 views2 pages

Enable Edge-to-Edge in AndroidX Activity

The document contains an XML layout and Java code for an Android application activity named MainActivity. It includes a TimePicker that allows users to select a time, which is then displayed in a TextView. The application uses edge-to-edge display and shows a toast message with the selected time when the time is changed.

Uploaded by

Kolekar Yashraj
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)
39 views2 pages

Enable Edge-to-Edge in AndroidX Activity

The document contains an XML layout and Java code for an Android application activity named MainActivity. It includes a TimePicker that allows users to select a time, which is then displayed in a TextView. The application uses edge-to-edge display and shows a toast message with the selected time when the time is changed.

Uploaded by

Kolekar Yashraj
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

XML File [Link].

AppCompatActivity;
import [Link];
<?xml version="1.0" encoding="utf-8"?>
import [Link];
<RelativeLayout
import
xmlns:android="[Link]
[Link];
apk/res/android"
public class MainActivity extends
xmlns:app="[Link]
AppCompatActivity {
res-auto"
TextView time;
TimePicker simple;
xmlns:tools="[Link]
ls"
@Override
android:id="@+id/main"
protected void onCreate(Bundle
android:layout_width="match_parent"
savedInstanceState) {
android:layout_height="match_parent"
[Link](savedInstanceState);
tools:context=".MainActivity">
[Link](this);
<TimePicker
setContentView([Link].activity_main);
android:id="@+id/simple"
time=findViewById([Link]);
android:layout_width="wrap_content"
simple=findViewById([Link]);
android:layout_height="wrap_content"
simple.setIs24HourView(false);
android:layout_centerHorizontal="true"
[Link](new
android:layout_marginTop="120dp"
[Link]() {
android:timePickerMode="spinner"/>
@Override
public void onTimeChanged(TimePicker
<TextView
view, int hourOfDay, int minute) {
android:id="@+id/time"
int hourOfday = 0;
android:layout_width="wrap_content"
android:layout_height="wrap_content"
[Link](getApplicationContext(),hour
android:text="Time is ="
Ofday+" "+minute,
android:layout_marginTop="100dp"
Toast.LENGTH_SHORT).show();
android:textSize="20dp"
[Link]("Time
android:layout_marginLeft="100dp"
is:"+hourOfDay+":"+minute);
/>
}
});

</RelativeLayout>

Activity File }
}
package [Link].prac15;
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];

import [Link];
import
OUTPUT

You might also like