아래에도 질문을 드렸는데요
다시 질문을 드리겠습니다.

소켓통신에서 수신하는 부분을 스레드로 돌려놨는데요
데이터를 수신되면
텍스트뷰를 셋하게 하도록 두었는데
어떤분이 스레드부에서는 뷰 set이 안된다고 하더라구요

그래서 다른부분으로 옮겨 보려 하는데..
데이터가 들어올때마다 뷰를 set 해야 하는데 마땅히 넣어줄 부분이 안보이네요...
(이벤트 부분에도 넣어줘 봤는데 여기서도 뷰 set이 안되네요..ㅠ)

소스좀 보시고 조언좀 부탁드립니다.
소스가 간단해서 보시는데 어려움이 없으실것 같습니다.

간단히 버튼을 클릭시 마다 데이터를 전송하고 on 또는 off 라는 데이터를 스레드부에서 수신하게 되어있습니다.
그런데 log를 찍어보니깐
버튼 클릭시에는 어떠한 현상도 없다가
뒤로가기 버튼을 누르니
수신부 데이터에 onoffonoffonoffonoff
이렇게 로그가 뜨더라구요..
이 부분 설명과 코드부를 유심히 봐주시고 조언 주시면 감사하겠습니다.



public class control extends Activity implements OnClickListener {
 private String doorName;
 private String doorAddress;
 private Socket socket;
 private String status;
 private PrintWriter out;
 private InputStream is;
 private BufferedReader reader;
 private TextView controlStatus;
 
 public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.control);
       
        status = null;
        Intent intent = getIntent();
        doorName = intent.getStringExtra("data_name");
        doorAddress = intent.getStringExtra("data_address");
        String dd = doorAddress;
        TextView name_view = (TextView)findViewById(R.id.control_name);
        name_view.setText(doorName);
       
        Button controlButton = (Button)findViewById(R.id.control_control);
        controlButton.setOnClickListener(this);
        Button controlButton2 = (Button)findViewById(R.id.control_back);
        controlButton2.setOnClickListener(this);
        controlStatus = (TextView)findViewById(R.id.control_status);

        try { //소켓 생성
         socket = new Socket("192.168.204.143", 7777);
         out = new PrintWriter( new BufferedWriter( new OutputStreamWriter(socket.getOutputStream())),true);
         is = socket.getInputStream();
         reader = new BufferedReader(new InputStreamReader(is));

         Thread th = new Thread(new inputData());//데이터 수신을 위한 스레드 생성
         th.start();
        
         out.println("returnStatus");//연결을 알리는 첫번째 데이터 전송.
       
        }catch (Exception e) {
   showToast(" " + "C: Error" + " ");
        }       
 }
 
 public class inputData implements Runnable{
  public void run(){
   String value=null;
   try {
    
   while ((value = reader.readLine()) != null){
     status = value; //이 부분에서 status 데이터를 수신.
     Log.d("MyLog", "View value : " + status);
     //controlStatus.setText(status);//데이터가 수신이 되면 텍스트 뷰를 셋팅. 안됨.ㅠ
    }
   }catch(Exception e) {
        showToast(" " + "S: Error" + " ");
   }
  }
 }
 
 public void onClick(View v){
     switch(v.getId()){
     case R.id.control_control://버튼 클릭시 상대방에게 데이터 전송하고 데이터 수신하여 텍스트뷰 설정
      out.println("controlStatus");
      //controlStatus.setText(status); //여기도 안됨.ㅠㅠ
      break;
     case R.id.control_back: //소켓 연결 해제
      try {
       out.println("EXIT");
       socket.close();
       finish();
    
   } catch (IOException e)
   {}    
     }
 }
 private void showToast(String msg) {
     Toast.makeText(this,msg,Toast.LENGTH_SHORT).show();
    }
}