2014-07-06 5 views
0

https://stackoverflow.com/questions/24591165/android-http-reponse-code-error에서 논의 된대로 http 게시를 통해 로그인 할 활동을 만들려고합니다. 어쨌든 테스트에 내 로그 캣에 다음과 같은 두 가지 경고가 계속 :Android : SingleClientConnManager를 잘못 사용했습니다. consumeContent()를 추가 한 후에도 연결이 여전히 할당되었습니다.

07-06 11 : 55 : 16.934을 : SingleClientConnManager (1049)/W : SingleClientConnManager의 잘못된 사용 : 아직 할당 연결. 07-06 11 : 55 : 16.934 : W/SingleClientConnManager (1049) : 다른 하나를 할당하기 전에 연결을 해제해야합니다.

나는 몇 가지에 유래 주위를 검색 한 사람들이 recommned으로 나는 다음과 같은 코드를 추가하는 시도 :

response.getEntity().consumeContent(); 

하지만 난 여전히 몇 가지 경고를 받고 있습니다. 내 게시물 요청 기능에 대한 코드는 다음과 같습니다.

private void sendRequest() { 
     // TODO Auto-generated method stub 
     try { 
      // Add your data 
      List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); 
      nameValuePairs.add(new BasicNameValuePair("username", username)); 
      nameValuePairs.add(new BasicNameValuePair("password", password)); 
      httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); 

      // Execute HTTP Post Request 
      HttpResponse response = httpclient.execute(httppost); 
      status = response.getStatusLine().getStatusCode(); 
      response.getEntity().consumeContent(); 
     } catch (ClientProtocolException e) { 
      // TODO Auto-generated catch block 
     } catch (IOException e) { 
      // TODO Auto-generated catch block 
     } 
    } 

내가 뭘 잘못하고 있다고 생각합니까?

답변