【Android源码 栏目提醒】:网学会员,鉴于大家对Android源码 十分关注,论文会员在此为大家搜集整理了“Android手机端控制源码 - 技术总结”一文,供大家参考学习!
开开开开下面始介
Android开开开手机端控制程序的写开首先打Eclipse当然之前的Java开开开开开开开开开开开开开开开开开开开开开境和安卓工具自己得先配置好里就不多开开了网上教程一大。
然后新建一个
Android开目修改布局文件main.xml开开开开代如下开开开开开开开开开开开开开开个布局文件的效果就是如中所示的手机操作界面。
开开开开开开开开开开开开开开开开开开开开开开开开开然后是限声明一不能少否将无法使用安卓手机的牙功能。
步开限声明如下开打AndroidManifest.xml开开开开文件修改代如下开开开开开开开开开开开开开开开开开开其中色、加粗部分就是要添加的限声明。
开开然后写Activity开开开开开开开开开开开开开开开开开开开开开开开开开开开中的行代些代的作用就是送指令控制小的运。
开开开开代如下package com.ThinBTClient.wwwimport
android.app.Activityimport
android.os.Bundleimport java.io.IOExceptionimport java.io.OutputStreamimport java.util.UUIDimport
android.app.Activityimport
android.bluetooth.BluetoothAdapterimport
android.bluetooth.BluetoothDeviceimport
android.bluetooth.BluetoothSocketimport
android.content.DialogInterfaceimport
android.content.DialogInterface.OnClickListenerimport
android.os.Bundleimport
android.provider.ContactsContract.CommonDataKinds.Eventimport
android.util.Logimport
android.view.MotionEventimport
android.view.Viewimport
android.widget.Buttonimport
android.widget.Toastpublic class ThinBTClient extends Activity private static final String TAG THINBTCLIENTprivate static final boolean D trueprivate BluetoothAdapter mBluetoothAdapter nullprivate BluetoothSocket btSocket nullprivate OutputStream outStream nullButton mButtonFButton mButtonBButton mButtonLButton mButtonRButton mButtonSprivate static final UUID MY_UUID UUID.fromString00001101-0000-1000-8000-00805F9B34FBprivate static String address 00:11:03:21:00:43 //