스레드로 채팅프로그램을 돌리고 있는데요.....

ip를 틀리게 했을 경우에 "서버와 연결이 불가능합니다" 를 쓰려고 합니다...

그런데... 에러가 자꾸 납니다 ㅠㅠㅠ 이거 어떻게 해야할지 너무 막막하네요,....

 

에러가 나는 이유는...( arrList가 ListAdapter이고 . 그리고 adapter는 BaseAdapter입니다. 근데  arrList.add 한 다음에...

adapter.notifyDataSetChanged(); 에서 에러가 납니다 ㅠㅠ

이거 말고도 TextView인 tvResult에서 tvResult.setText를 하는데도 에러가 나네요 ㅠㅠ

 

좀 도와주세요 ㅠㅠㅠㅠㅠㅠㅠㅠ 

 

public void run()
  {
   arrList.add(new MyData("연결중...", m_recvDirection));
   adapter.notifyDataSetChanged();
   try {
    m_socket = new Socket("xx.xx.x.xxx", xxxx);
    this.isConnected=true;
   } catch (UnknownHostException e) {
    // TODO Auto-generated catch block
    m_socket=null;
   } catch (IOException e) {
    // TODO Auto-generated catch block
    arrList.add(new MyData("실패...", m_recvDirection));
    adapter.notifyDataSetChanged();
   }
   
   //만약에 m_socket에 값이 있다면...
   if(this.isConnected){
    InputStream is = null;
    OutputStream os = null;
    try {
     is = m_socket.getInputStream();
     os = m_socket.getOutputStream();
     reader = new BufferedReader(new InputStreamReader(is, "euc-kr"));
     writer = new PrintWriter(new OutputStreamWriter(os, "euc-kr"));
    } catch (UnknownHostException e){
     arrList.add(new MyData("Not Connected", m_recvDirection));
     adapter.notifyDataSetChanged();
    } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
    }
    
   
    
 
    m_bRun = true;
 
    while( m_bRun )
    {
     String msg = null;
 
     try {
      msg = reader.readLine();
     } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      break;
     }
 
     if( 0 == msg.length() )
     {
         
      break;
      
     }
 
     if(msg.contains("#thisisoverqkqhdidlRjwutlqtpdislelwlffkrhghkswkdgoTsk")){
      addResult(null, end);
     }
     else
     {
      addResult(msg, nothing);
     }
    }

   try {
    m_socket.close();
    m_socket = null;
    arrList.add(new MyData("Disconnected", m_recvDirection));
    adapter.notifyDataSetChanged();
   } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
   }
   
   //만약에 받아오질 못했다면...
   
  }