마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

안드로이드 블루투스 값 db 저장 질문입니다.

0 추천
package com.example.blunobasicdemo;
 
import android.os.Bundle;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
 
public class BlunoActivity  extends BlunoLibrary {
private Button buttonScan;
private Button buttonSerialSend;
private EditText serialSendText;
private TextView serialReceivedText;
 
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.bluno);
        onCreateProcess(); //onCreate Process by BlunoLibrary
        
        serialBegin(115200); //set the Uart Baudrate on BLE chip to 115200
 
        serialReceivedText=(TextView) findViewById(R.id.serialReveicedText); //initial the EditText of the received data
; //initial the EditText of the sending data
        
//initial the button for sending the data
 
        
        buttonScan = (Button) findViewById(R.id.buttonScan); //initial the button for scanning the BLE device
        buttonScan.setOnClickListener(new OnClickListener() {
 
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
 
buttonScanOnClickProcess(); //Alert Dialog for selecting the BLE device
}
});
}
 
protected void onResume(){
super.onResume();
System.out.println("BlUNOActivity onResume");
onResumeProcess(); //onResume Process by BlunoLibrary
}
 
 
 
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
onActivityResultProcess(requestCode, resultCode, data); //onActivityResult Process by BlunoLibrary
super.onActivityResult(requestCode, resultCode, data);
}
 
    @Override
    protected void onPause() {
        super.onPause();
        onPauseProcess(); //onPause Process by BlunoLibrary
    }
 
protected void onStop() {
super.onStop();
onStopProcess(); //onStop Process by BlunoLibrary
}
    
@Override
    protected void onDestroy() {
        super.onDestroy();
        onDestroyProcess(); //onDestroy Process by BlunoLibrary
    }
 
@Override
public void onConectionStateChange(connectionStateEnum theConnectionState) {//Once connection state changes, this function will be called
switch (theConnectionState) { //Four connection state
case isConnected:
buttonScan.setText("Connected");
break;
case isConnecting:
buttonScan.setText("Connecting");
break;
case isToScan:
buttonScan.setText("Scan");
break;
case isScanning:
buttonScan.setText("Scanning");
break;
case isDisconnecting:
buttonScan.setText("isDisconnecting");
break;
default:
break;
}
}
 
@Override
public void onSerialReceived(String theString) { //Once connection data received, this function will be called
// TODO Auto-generated method stub
serialReceivedText.append(theString); //append the text into the EditText
//The Serial data from the BLUNO may be sub-packaged, so using a buffer to hold the String is a good choice.
 
}
 
}
우선 scan 버튼을 누르면 블루투스의 값을 화면에 띄우는것까지는 성공했습니다. 문제는 이 값을 어떻게 db로 저장해야되는지 모르겠습니다. 이 값은 db로 보내서 3000-값 이렇게 할려고 생각중인데요. 어떻게 해야할지 잘 모르겠습니다.
 
익명사용자 님이 2014년 10월 27일 질문

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...