CommunicationService.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:rothar-android-app 作者:
@Override
protected HttpResponse doInBackground(String... params) {           
    String link = params[0];
    String payload = params[1];
    AndroidHttpClient client = AndroidHttpClient.newInstance("Android");
    HttpPost request = new HttpPost(link);
    HttpResponse response = null;
    request.setHeader( "Content-Type", "application/json" );
    try {
        StringEntity se = new StringEntity(payload);
     se.setContentEncoding("UTF-8");
     se.setContentType("application/json");         
     request.setEntity(se);             
     response = client.execute(request);
    } catch (IOException e) {
        log(e.getMessage());
        e.printStackTrace();
    } finally {
        client.close();
    }
    return response;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号