单片机与接口技术课外制作-Android蓝牙遥控小车编程参考
《单片机与接口技术》课外制作(课程设计)编程参考(1)
Android蓝牙遥控程序设计
邹立杰
广州大学华软软件学院 软件工程系
2014.5.22
1. Configuration the Development Environment:
(1) Download and install/configuration Java SDK SE
You can seek methods from internet .specially,you need configuration the system environment variable “path”. (2) Download and Install Android Development IDE
Download the package:
adt-bundle-windows-x86_64-20140321.zip from the URL:
/sdk/index.html
download web page:
(3) Unpackaged the package
adt-bundle-windows-x86_64-20140321.zip to a directory on your hard disk.
Ok, your android development environment is ok!
2. Ctreate a Virtual Device for Your Android Application:
(1) start eclipse application by double click the
executable file:
The application window:
Select the menu item as below:
The appear the AVD manager dialog:
Click the “New”button:
Fill the AVD name as you like name; Select a device; Select a Target; Select a CPU/ABI; Select a skin;
Any default item you can select. The reference select as below:
When the below dialog appeared ,youe AVD is created ok.
Start the AVD:
Don’t close the AVD , Keep the AVD alived !
3. Design Your Car Blue-teeth Remote Program
(1)
Create an Android Application Project:
Fill the dialog items:
the click the “Next” button
Click the “Next” Button:
Click the “Next” button
And continue to click the “Next” button:
Click “Finish” button,your android application project is created!
Project Files Struchure:
(2)
Modify the AndroidManifest.xml file:
<manifest xmlns:android="/apk/res/android" package="com.example.blue" android:versionCode="1"
android:versionName="1.0" > <uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.BLUETOOTH" /> <application
android:icon="@drawable/ic_launcher" android:label="@string/app_name"
android:theme="@style/AppTheme" > <activity
android:name=".MainActivity"
android:label="@string/title_activity_main" > <intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="UNCHER" /> </intent-filter> </activity> </application> </manifest>
Add 2 sentences to the AndroidManifest.xml file.
(3)
Modify the layout file activity_main.xml
<?xml version="1.0" encoding="utf-8"?> <AbsoluteLayout
android:id="@+id/widget0"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="/apk/res/android" android:background="@drawable/sise" >
<Button
android:id="@+id/btnF"
android:layout_width="88dp"
android:layout_height="wrap_content" android:layout_x="124dp" android:layout_y="58dp" android:text="向前" />
<Button
android:id="@+id/btnS"
android:layout_width="88dp"
android:layout_height="wrap_content" android:layout_x="124dp" android:layout_y="140dp" android:text="停止" /> <Button
android:id="@+id/btnB"
android:layout_width="88dp"
android:layout_height="wrap_content" android:layout_x="124dp" android:layout_y="222dp" android:text="后退" /> <Button
android:id="@+id/btnR"
android:layout_width="88dp"
android:layout_height="wrap_content" android:layout_x="227dp" android:layout_y="140dp" android:text="右转" /> <Button
android:id="@+id/btnL"
android:layout_width="88dp"
android:layout_height="wrap_content" android:layout_x="23dp" android:layout_y="140dp" android:text="左转" /> </AbsoluteLayout>
(4) Modify the resurce file strings.xml
<resources>
<string name="app_name">蓝牙小车遥控-华软学院</string> <string name="hello_world">Hello world!</string> <string name="menu_settings">Settings</string>
<string name="title_activity_main">蓝牙小车遥控-华软学院</string> </resources>
(5) Modify the Main Activity file MainActivity.java
package com.example.blue;
import android.os.Bundle; import android.app.Activity; import android.view.Menu; import java.io.IOException; import java.io.OutputStream; import java.util.UUID;
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import android.view.Gravity;
import android.view.MotionEvent; import android.view.View;
import android.widget.Button; import android.widget.Toast; import com.example.blue.R;
public class MainActivity extends Activity {
…… 此处隐藏:3885字,全部文档内容请下载后查看。喜欢就下载吧 ……
相关推荐:
- [专业资料]《蜜蜂之家》教学反思
- [专业资料]过去分词作定语和表语1
- [专业资料]苏州工业园区住房公积金贷款申请表
- [专业资料]保安管理制度及处罚条例细则
- [专业资料]2018年中国工程咨询市场发展现状调研及
- [专业资料]2015年电大本科《学前教育科研方法》期
- [专业资料]数字信号处理实验 matlab版 离散傅里叶
- [专业资料]“十三五”重点项目-虎杖白藜芦醇及功
- [专业资料]2015-2020年中国竹木工艺市场需求及投
- [专业资料]国际贸易理论与实务作业五:理论案例分
- [专业资料]财政部修订发布事业单位会计制度
- [专业资料]BCA蛋白浓度测定试剂盒(增强型)
- [专业资料]工程进度总计划横道图模板(通用版)
- [专业资料]七年级地理同步练习(天气与气候)
- [专业资料]X光安检机介绍火灾自动报警系统的组成
- [专业资料]衢州市人民政府办公室关于印发衢州市区
- [专业资料]经济全球化及其影响[1]
- [专业资料]质粒DNA限制性酶切图谱分析
- [专业资料]国家安全人民防线工作“六项”制度
- [专业资料]劳动力投入计划及保证措施
- 电子账册联网监管培训手册
- 人教版语文七年级上第1课《在山的那边
- 对我区担保行业发展现状的思考与建议
- 平面四边形网格自动生成方法研究
- 2016年党课学习心得体会范文
- 如何设置电脑定时关机
- 全球最美人妖排行榜新鲜出炉
- 社会实践调查报告及问卷
- Visual Basic习题集
- 《鱼我所欲也》课件2
- 浙江省会计从业资格考试试卷
- 全遥控数字音量控制的D 类功率放大器资
- 鞍钢宪法与后福特主义
- 电表的改装与校准实验报告(1)
- 2014年高考理科数学真题解析分类汇编:
- Windows 7 AIK 的使用
- 风电场全场停电事故应急处置方案
- 化工原理选填题题库(下)
- 关于产学研合作教育模式的学习与思考
- 西安先锋公馆项目前期定位报告




