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

intent 소스 질문이요 ........

0 추천
제가 intent를 이용해서 데이터를 첫번째 액티비티에서 두번째 액티비티로 보내 출력하는거 인데요
어플을 핸드폰에서 실행했을때 알수없음이라고 뜨면서 바로 꺼지네요 ㅜㅜ
어디가 틀린건가요
첫번째 액티비티 
 
public void run() {
            Log.i(TAG, "BEGIN mConnectedThread");
            byte[] buffer = new byte[1024];
            
             int bytes;         
            
            // Keep listening to the InputStream while connected
            while (true) {
                try {
                    // Read from the InputStream
                String message1="";
                while (message1.length()<9) {
                bytes = mmInStream.read(buffer);
                    message1 = message1.concat(new String(buffer,0,bytes));}
                                   
               
                Intent intent =new Intent(BlueToothService.this, MainController.class);
                intent.putExtra("SendData_Key",message1);
                startActivity(intent);
                   
                } catch (IOException e) {
                    Log.e(TAG, "disconnected", e);
                    connectionLost();
                    break;
                }
            }
        }
 
2번째 액티비티
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setOnClickListener((ViewGroup)findViewById(R.id.tblButtons));
mStatus = (TextView) findViewById(R.id.txtStatus);
// Get local Bluetooth adapter
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
mmessage = (TextView) findViewById(R.id.Tv1);
Intent intent = getIntent();
String receivedData = intent.getStringExtra("SendData_Key");
setResult(RESULT_OK,intent);
mmessage.setText(receivedData);

 

익명사용자 님이 2014년 10월 3일 질문
로그를 올려주세요......

답변 달기

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