안녕하세요
제가 아두이노를 이용해서 블루투스로 문자열(Aa, Ea, Ha)를 전송하면
안드로이드가 문자열에 따라 어플 버튼을 누르는 작업을 만들고 있습니다.
이 작업은 잘 되고 있는데
전송받은 문자열을 txt나 문자파일을 이용해서
저장, 로드하고 싶습니다.
어떤 식으로 저장하면 될지 모르겠어서
도움을 청합니다.
 
// 문자열 수신 쓰레드
        mWorkerThread = new Thread(new Runnable() {
            public void run() {
                while (!Thread.currentThread().isInterrupted()) {
                    try {
                        int bytesAvailable = mInputStream.available(); // 수신 데이터 확인
                        if (bytesAvailable > 0) { // 데이터가 수신된 경우
                            byte[] packetBytes = new byte[bytesAvailable];
                            mInputStream.read(packetBytes);
                            for (int i = 0; i < bytesAvailable; i++) {
                                byte b = packetBytes[i];
                                if (b == mCharDelimiter) {
                                    byte[] encodedBytes = new byte[readBufferPosition];
                                    System.arraycopy(readBuffer, 0, encodedBytes, 0, encodedBytes.length);
                                    final String data = new String(encodedBytes, "US-ASCII");
                                    readBufferPosition = 0;
                                    handler.post(new Runnable() {
                                        public void run() { // 수신된 문자열 데이터에 대한 처리 작업
                                            if(readBuffer[0]=='A') {
                                                base.performClick();
                                            }else if(readBuffer[0]=='B'){
                                                snare.performClick();
                                            }else if(readBuffer[0]=='E'){
                                                tom.performClick();
                                            }else if(readBuffer[0]=='K'){
                                                hithat.performClick();
                                            }else if(readBuffer[0]=='S'){
                                                crash.performClick();;
                                            }else if(readBuffer[0]=='T'){
                                                restart1.performClick();
                                            }
                                        }
                                    });
                                } else {
                                    readBuffer[readBufferPosition++] = b;
                                }
                            }
                        }
                    } catch (IOException ex) { // 데이터 수신 중 오류 발생
                        Toast.makeText(getApplicationContext(), "데이터 수신 중 오류가 발생", Toast.LENGTH_LONG).show();
                        finish();
                    }
                }
            }
        });
        mWorkerThread.start();
    }