protected Void doInBackground(Void... params) {
//server able to receive it
ArrayList<NameValuePair> dataToSend = new ArrayList<>();
dataToSend.add(new BasicNameValuePair("username", user.username));
dataToSend.add(new BasicNameValuePair("password", user.password));
HttpParams httpRequestParams = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpRequestParams, CONNECTION_TIMEOUT);
HttpConnectionParams.setSoTimeout(httpRequestParams, CONNECTION_TIMEOUT);
HttpClient client = new DefaultHttpClient(httpRequestParams);
HttpPost post = new HttpPost(SERVER_ADDRESS + "Register.php");
post.setEntity();
return null;
}
答案 0 :(得分:0)
build.gradle(Module:app)
中的useLibrary,例如:
defaultConfig {
applicationId "com.example.softwareengineer.robot"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
useLibrary 'org.apache.http.legacy'
}