You are on page 1of 3

Name :- Madhura Kank

Roll no :- 23
Practical 24

Xml File:-

<Rela veLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
xmlns:android="h p://schemas.android.com/apk/res/android">
<Bu on
android:id="@+id/turnOnBu on"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Turn On Bluetooth"/>
<Bu on
android:id="@+id/getVisibleBu on"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/turnOnBu on"
android:layout_marginTop="16dp"

android:text="Get Visible"/>
<ListView
android:id="@+id/devicesListView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/getVisibleBu on"
android:layout_marginTop="16dp"/>
<Bu on
android:id="@+id/turnOffBu on"

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/devicesListView"
android:layout_marginTop="16dp"
android:text="Turn Off Bluetooth"/>
</Rela veLayout>

Java File:-
package com.example.practical24;

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat

class MainActivity : AppCompatActivity() {


override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContentView(R.layout.activity_main)
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main))
{ v, insets ->
val systemBars =
insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(/* left = */ systemBars.left, /* top = */
systemBars.top, /* right = */
systemBars.right, /* bottom = */
systemBars.bottom)
insets
}
}
}

You might also like