Page 93

Android Programming Cookbook

85 / 143

android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <EditText android:id="@+id/edit_text_out" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom" android:layout_weight="1" /> <Button android:id="@+id/button_send" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/send" /> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/scan" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="connect" android:text="@string/connect" /> <Button android:id="@+id/discoverable" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="discoverable" android:text="@string/discoverable" /> </LinearLayout> </LinearLayout>

5.4

Create the source code of the BluetoothChat

Add a new Java class inside src/com.javacodegeeks.androidBluetoothExample/ so that we are going to have the src/com.javacodegeeks.androidBluetoothExample/BluetoothChat.java file and paste the code below. BluetoothChat.java package com.javacodegeeks.androidBluetoothExample; import import import import import import import import import import import import

android.app.Activity; android.bluetooth.BluetoothAdapter; android.bluetooth.BluetoothDevice; android.content.Intent; android.os.Bundle; android.os.Handler; android.os.Message; android.support.v7.widget.DefaultItemAnimator; android.support.v7.widget.LinearLayoutManager; android.support.v7.widget.RecyclerView; android.view.KeyEvent; android.view.View;

SKY MAGZ  

This is Yahya Christian School Magazine

Read more
Read more
Similar to
Popular now
Just for you