Practical No 24
Practical No 24
droid:text="Turn Off"
Name:-Roshan kumar
droid:layout_below="@id/btn_list_devices"
<?xml version="1.0" encoding="utf-8"?> android:layout_centerHorizontal="true"
<RelativeLayout android:layout_marginTop="20dp" />
xmlns:android="http://schemas.android.com/apk/res/
android" <!-- Output TextView to show List of Devices -->
android:layout_width="match_parent" <TextView
android:layout_height="match_parent"> android:id="@+id/tv_output"
android:layout_width="wrap_content"
<!--Bluetooth Image --> android:layout_height="wrap_content"
<ImageView android:text=""
android:id="@+id/bluetooth_image" android:layout_below="@id/btn_turn_off"
android:layout_width="150dp" android:layout_marginTop="20dp"
android:layout_height="150dp" android:layout_centerHorizontal="true" />
android:src="@drawable/blutooth" </RelativeLayout>
android:layout_centerHorizontal="true"
Mainactivity.java file:
android:layout_marginTop="50dp" />
package com.example.hello;
<!-- Turn On Button -->
<Button import android.bluetooth.BluetoothAdapter;
android:id="@+id/btn_turn_on" import android.bluetooth.BluetoothDevice;
android:layout_width="wrap_content" import android.content.Intent;
android:layout_height="wrap_content" import android.content.pm.PackageManager;
android:text="Turn On" import android.os.Bundle;
android:layout_below="@id/bluetooth_image" import android.widget.Button;
android:layout_centerHorizontal="true" import android.widget.TextView;
android:layout_marginTop="20dp" /> import android.widget.Toast;
output :
get visible button :