
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49


목차
[.settings]
[assets]
[bin]
[gen]
[libs]
[res]
[src]
.classpath
.project
AndroidManifest.xml
ic_launcher-web.png
proguard-project
project.properties
822KB
파일 49, 폴더 23
[assets]
[bin]
[gen]
[libs]
[res]
[src]
.classpath
.project
AndroidManifest.xml
ic_launcher-web.png
proguard-project
project.properties
822KB
파일 49, 폴더 23
본문내용
MainActivity.java
import android.app.Activity;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.os.Bundle;
public class MainActivity extends Activity implements OnClickListener {
private static final String TAG = \\"Main\\";
private static final int REQUEST_CONNECT_DEVICE = 1;
private static final int REQUEST_ENABLE_BT = 2;
private Button btn_Connect;
private TextView txt_Result;
private BluetoothService btService = null;
private final Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.e(TAG, \\"onCreate\\");
setContentView(R.layout.main);
btn_Connect = (Button) findViewById(R.id.btn_connect);
txt_Result = (TextView) findViewById(R.id.txt_result);
btn_Connect.setOnClickListener(this);
if(btService == null) {
btService = new BluetoothService(this, mHandler);
}
}
@Override
public void onClick(View v) {
if(btService.getDeviceState()) {
btService.enableBluetooth();
} else {
finish();
}
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.d(TAG, \\"onActivityResult \\" + resultCode);
switch (requestCode) {
case REQUEST_CONNECT_DEVICE:
if (resultCode == Activity.RESULT_OK) {
btService.getDeviceInfo(data);
}
break;
case REQUEST_ENABLE_BT:
// When the request to enable Bluetooth returns
if (resultCode == Activity.RESULT_OK) {
// Next Step
btService.scanDevice();
} else {
Log.d(TAG, \\"Bluetooth is not enabled\\");
}
break;
}
}
}
import android.app.Activity;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.os.Bundle;
public class MainActivity extends Activity implements OnClickListener {
private static final String TAG = \\"Main\\";
private static final int REQUEST_CONNECT_DEVICE = 1;
private static final int REQUEST_ENABLE_BT = 2;
private Button btn_Connect;
private TextView txt_Result;
private BluetoothService btService = null;
private final Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.e(TAG, \\"onCreate\\");
setContentView(R.layout.main);
btn_Connect = (Button) findViewById(R.id.btn_connect);
txt_Result = (TextView) findViewById(R.id.txt_result);
btn_Connect.setOnClickListener(this);
if(btService == null) {
btService = new BluetoothService(this, mHandler);
}
}
@Override
public void onClick(View v) {
if(btService.getDeviceState()) {
btService.enableBluetooth();
} else {
finish();
}
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.d(TAG, \\"onActivityResult \\" + resultCode);
switch (requestCode) {
case REQUEST_CONNECT_DEVICE:
if (resultCode == Activity.RESULT_OK) {
btService.getDeviceInfo(data);
}
break;
case REQUEST_ENABLE_BT:
// When the request to enable Bluetooth returns
if (resultCode == Activity.RESULT_OK) {
// Next Step
btService.scanDevice();
} else {
Log.d(TAG, \\"Bluetooth is not enabled\\");
}
break;
}
}
}
키워드
추천자료
[마케팅] 삼성전자 넥시오 `NEXiO` 전략
우수중수기업제품 리뷰
이동통신 서비스에 따른 고객전환 행동
삼성 yepp MP3 분석 및 마케팅 전략
유비쿼터스의 개념과 유비쿼터스 컴퓨팅의 특징 및 기술, 적용분야, 서비스 종류
LG전자의 글로벌 경영전략
삼성마케팅,마케팅,브랜드,브랜드마케팅,기업,서비스마케팅,글로벌,경영,시장,사례,swot,
유비쿼터스 컴퓨팅
구글글래스, 구글글라스 (Google Glass) 완벽정리
LG전자,트롬마케팅,트롬세탁기,마케팅,브랜드,브랜드마케팅,기업,서비스마케팅,글로벌,경영,...
애플워치 (스마트워치 Smart Watch) 완벽정리 {애플워치 정의와 특징 및 단점, 전망, 스마트...
(웨어러블 컴퓨터 ) 웨어러블 컴퓨터 기술의 이해 및 적용사례 [Wearable Computer Technology]
웨어리블 디바이스의 환대산업에서의 이용사례[WearableDevice in Hospitality Industry]디즈...
텀프로젝트 결과레포트 창문 방범 시스템
소개글