Page 1006 - 3-2
P. 1006
switch (msg.what) {
/*
case Constants.MESSAGE_STATE_CHANGE:
break;
case Constants.MESSAGE_WRITE:
break;
*/
case Constants.MESSAGE_READ:
byte[] readBuf = (byte[]) msg.obj;
// construct a string from the valid bytes in the buffer
String readMessage = new String(readBuf, 0, msg.arg1);
//mConversationArrayAdapter.add(mConnectedDeviceName + ": " +
readMessage);
Toast.makeText(getApplicationContext(),readMessage,Toast.LENGTH_SHORT).show();
break;
/*
case Constants.MESSAGE_DEVICE_NAME:
break;
case Constants.MESSAGE_TOAST:
break;
*/
}
}
};
public void onClick_blu(View v) {
if(btService.getDeviceState()) {
Toast.makeText(getApplicationContext(),
"raspberrypi 에 연결해주세요.",
Toast.LENGTH_SHORT).show();
btService.enableBluetooth();
}
else {
Toast.makeText(getApplicationContext(),
" 블루투스를 사용할 수 없는 기기입니다.",
Toast.LENGTH_SHORT).show();
}
}
public void onClick_ok(View v) {
String pw = ((EditText) findViewById(R.id.editText_pw)).getText().toString();
String name = ((EditText)findViewById(R.id.editText_name)).getText().toString();
selectDB(name, pw);
}
- 1006 -