Page 578 - MDP2020-1
P. 578

|    인천전자마이스터고등학교  ·············································································································
            572

                                    }
                            });
                            mBtnConnect.setOnClickListener(new  Button.OnClickListener()  {
                                    @Override

                                    public  void  onClick(View  view)  {
                                            listPairedDevices();
                                    }
                            });

                            userplus  =  findViewById(R.id.userplus);
                            mBtnSendData  =  findViewById(R.id.door);
                            userplus.setOnClickListener(new  View.OnClickListener()  {
                                    @Override
                                    public  void  onClick(View  v)  {
                                            Intent  intent  =  new  Intent(ButtonActivity.this,  UserPlusActivity.class);

                                            startActivity(intent);
                                    }
                            });
                            mBtnSendData.setOnClickListener(new  Button.OnClickListener()  {

                                    @Override
                                    public  void  onClick(View  view)  {
                                            if(mThreadConnectedBluetooth  !=  null)  {
                                                    mThreadConnectedBluetooth.write();
                                                    warning.setText("  ");
                                            }

                                            /*Intent  intent  =  new  Intent(ButtonActivity.this,  DoorActivity.class);
                                            startActivity(intent);*/
                                    }
                            });
                            mBluetoothHandler  =  new  Handler(){

                                    public  void  handleMessage(Message  msg){
                                            if  (msg.what  ==  BT_MESSAGE_READ){
                                                    String  readMessage  =  null;
                                                    try  {
                                                            readMessage  =  new  String((byte[])  msg.obj,  "UTF-8");

                                                    }  catch  (UnsupportedEncodingException  e)  {
                                                            e.printStackTrace();
                                                    }
                                                    String  str  =  readMessage.replaceAll("[^1]","");
                                                    if  (str.equals("1"))  {

                                                            Vibrator   vibrator    =               (Vibrator)
            getSystemService(Context.VIBRATOR_SERVICE);
   573   574   575   576   577   578   579   580   581   582   583