안녕하세요 .

웹과의 연동을 공부하는중 같은부분( HttpClient httpClient = new DefaultHttpClient()) 이부분이 계속적으로 에러가 나서 질문드립니다.

운영체제는 ics 입니다.


웹에서 json을 넘겨받는것인데 일단 커넥팅 자체가 안되는거 갔습니다.


웹사이트 경로를 http://www.google.co.kr  해도 마찬가지고 

어떠한 소스를 쓰더라도 


소스는  HttpClient httpClient  <-- 이부분에서 오류가 났습니다.

메인 액티비티에서 구연하면 안되는 건가요???


 public class MainActivity extends Activity {
 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.activity_main);
 
        JSONObject jobj  = new JSONObject();
        HashMap<String,String> param = new HashMap<String, String>();
        param.put("id", "test");
        param.put("pw", "1234");
        param.put("mode", "lg");
        try {
			jobj.put("jsp", sendData("http://localhost:8080/AndroidWebService/Login.do", "UTF-8", param));
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        
        
    }
    
    public HttpResponse sendData(String url, String encoding, Map param){
    	  HttpResponse response = null;
    	  try {
    	   HttpClient httpClient = new DefaultHttpClient();
    	   HttpPost httpPost = new HttpPost(url);
    	   List list = new ArrayList();
    	   Iterator it = param.keySet().iterator();
    	   while(it.hasNext()){
    	    String key = (String)it.next();
    	    list.add(new BasicNameValuePair(key,param.get(key).toString()));
    	   }
    	   httpPost.setEntity(new UrlEncodedFormEntity(list, encoding));
    	   response = httpClient.execute(httpPost);
    	  } catch (Exception e) {
    	   Log.e("Error", e.getMessage());
    	  }
    	  return response;
    	 }
    
    
}