HTTP post请求的IOException

时间:2015-05-27 10:10:58

标签: android accountmanager

我正在使用Account Manager客户经理创建一个登录表单,并为webservices创建HTTP任务。当我输入用户名和密码时,我会IOException,我添加了INTERNET PERMISSION和所有与帐户相关的权限。如果有人知道任何使用客户经理和网络服务的github示例请分享url.please help.this是代码 `

 public void userSignUp(String name, String email, String pass, String authType, final SignUPHandler handler) {

        HttpPost localHttpPost = new HttpPost(ApiURL.USERSIGNIN);

        JSONObject json_user = new JSONObject();

        try {
            json_user.put("email", email);
            json_user.put("password", pass);

            StringEntity se = new StringEntity(json_user.toString());
            localHttpPost.setEntity(se);
            if ((this.currentTask != null) && (this.currentTask.getStatus() != AsyncTask.Status.FINISHED))
                this.currentTask.cancel(true);

            this.currentTask = new HttpTask(ApiURL.HTTP_LOGIN_HOST, new HttpResponseHandler() {
                public void handleException(Exception paramException) {
                    Log.e("Exceptionssssssss:", "" + paramException);
                    handler.handleException(paramException);
                }

                public void handleResponse(JSONObject json)
                        throws IOException {
                    Log.d("response", "" + json);
                    handler.handleResponse(json);
                }
            });
            this.currentTask.execute(new HttpUriRequest[]{localHttpPost});
        } catch (Exception localException) {
            Log.d("Exception ID", "" + localException.getMessage());
        }
    }`

0 个答案:

没有答案