目标主机不能为空,也不能在参数中设置。方案=null,主机=null,路径=eocribin.netne.net/FetchUserData.php
Target host must not be null, or set in parameters. scheme=null, host=null, path=eocribin.netne.net/FetchUserData.php
收到错误,我不知道为什么我已经看了几个小时了,我觉得这是我遗漏的基本内容有人可以看看它可能是什么吗?
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;
}
您在 path=eocribin.netne.net/FetchUserData.php
中缺少 "http://"
收到错误,我不知道为什么我已经看了几个小时了,我觉得这是我遗漏的基本内容有人可以看看它可能是什么吗?
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;
}
您在 path=eocribin.netne.net/FetchUserData.php