Android 目标主机不能为null,也不能在参数中设置。scheme=null,host=null,path=eocribin.netne.net/FetchUserData.php

Android 目标主机不能为null,也不能在参数中设置。scheme=null,host=null,path=eocribin.netne.net/FetchUserData.php,android,server,database-connection,host,Android,Server,Database Connection,Host,得到错误,我不知道为什么我已经看了几个小时,我觉得这是一些基本的东西,我错过了谁可以看看,看看它可能是什么 public class ServerRequests { ProgressDialog progressDialog; public static final int CONNECTION_TIMEOUT = 1000 * 15; public static final String SERVER_ADDRESS = "http://eoc

得到错误,我不知道为什么我已经看了几个小时,我觉得这是一些基本的东西,我错过了谁可以看看,看看它可能是什么

public class ServerRequests {
        ProgressDialog progressDialog;
        public static final int CONNECTION_TIMEOUT = 1000 * 15;
        public static final String SERVER_ADDRESS = "http://eocribin.netne.net";
我觉得我已经在上面的部分中标记了主机,以便稍后用作变量,但它只将其注册为路径

    public ServerRequests(Context context) {
        progressDialog = new ProgressDialog(context);
        progressDialog.setCancelable(false);
        progressDialog.setTitle("Processing...");
        progressDialog.setMessage("Please wait...");
    }

    public void storeUserDataInBackground(User user,
                                          GetUserCallback userCallBack) {
        progressDialog.show();
        new StoreUserDataAsyncTask(user, userCallBack).execute();
    }

    public void fetchUserDataAsyncTask(User user, GetUserCallback userCallBack) {
        progressDialog.show();
        new fetchUserDataAsyncTask(user, userCallBack).execute();
    }

    /**
     * parameter sent to task upon execution progress published during
     * background computation result of the background computation
     */

    public class StoreUserDataAsyncTask extends AsyncTask<Void, Void, Void> {
        User user;
        GetUserCallback userCallBack;

        public StoreUserDataAsyncTask(User user, GetUserCallback userCallBack) {
            this.user = user;
            this.userCallBack = userCallBack;
        }

        @Override
        protected Void doInBackground(Void... params) {
            ArrayList<NameValuePair> dataToSend = new ArrayList<>();
            dataToSend.add(new BasicNameValuePair("name", user.name));
            dataToSend.add(new BasicNameValuePair("username", user.username));
            dataToSend.add(new BasicNameValuePair("password", user.password));
            dataToSend.add(new BasicNameValuePair("age", user.age + ""));

            HttpParams httpRequestParams = getHttpRequestParams();

            HttpClient client = new DefaultHttpClient(httpRequestParams);
            HttpPost post = new HttpPost(SERVER_ADDRESS
                    + "/Register.php");

            try {
                post.setEntity(new UrlEncodedFormEntity(dataToSend));
                client.execute(post);
            } catch (Exception e) {
                e.printStackTrace();
            }

            return null;
        }
公共服务器请求(上下文){
progressDialog=新建progressDialog(上下文);
progressDialog.setCancelable(假);
progressDialog.setTitle(“处理…”);
progressDialog.setMessage(“请稍候…”);
}
public void storeUserDataInBackground(用户,
GetUserCallback(用户回调){
progressDialog.show();
新建StoreUserDataAsyncTask(用户,userCallBack).execute();
}
public void fetchUserDataAsyncTask(用户用户,GetUserCallback userCallBack){
progressDialog.show();
新建fetchUserDataAsyncTask(用户,userCallBack).execute();
}
/**
*在期间发布执行进度时发送给任务的参数
*背景计算的背景计算结果
*/
公共类StoreUserDataAsyncTask扩展了AsyncTask{
用户;
GetUserCallback-userCallBack;
public StoreUserDataAsyncTask(用户用户,GetUserCallback userCallBack){
this.user=用户;
this.userCallBack=userCallBack;
}
@凌驾
受保护的Void doInBackground(Void…参数){
ArrayList dataToSend=新的ArrayList();
添加(新的BasicNameValuePair(“name”,user.name));
添加(新的BasicNameValuePair(“username”,user.username));
添加(新的BasicNameValuePair(“密码”,user.password));
添加(新的BasicNameValuePair(“age”,user.age+);
HttpParams httpRequestParams=getHttpRequestParams();
HttpClient客户端=新的默认HttpClient(httpRequestParams);
HttpPost=新的HttpPost(服务器地址
+“/Register.php”);
试一试{
post.setEntity(新的UrlEncodedFormEntity(dataToSend));
客户。执行(post);
}捕获(例外e){
e、 printStackTrace();
}
返回null;
}

您在
path=eocribin.netne.net/FetchUserData.php中缺少“http://”我想您缺少了“http://”从
path=eocribin.netne.net/FetchUserData.php
中,我想我已经用过它了,但显然不是谢谢你!我将把它作为一个答案发布。我想你缺少了“http://”从
path=eocribin.netne.net/FetchUserData.php
中,我想我已经用过它了,但显然不感谢它!我将把它作为一个答案发布