這裏是我的代碼表示棄用的NameValuePair,BasicNameValuePair,的HttpParams,HttpClient的,DefaultHttpClient,HttpPost,UrlEncodedFormEntity 如何解決,我現在面臨這個問題...已過時的NameValuePair
ArrayList<NameValuePair> dataTosend = new ArrayList<>();
dataTosend.add(new BasicNameValuePair("image" , encodedImage));
dataTosend.add(new BasicNameValuePair("name" , name));
HttpParams httpRequestParams = getHttpRequestParams();
HttpClient client = new DefaultHttpClient(httpRequestParams);
HttpPost post = new HttpPost(SERVER_ADDRESS + "savepicture.php");
try{
post.setEntity(new UrlEncodedFormEntity(dataTosend));
client.execute(post);
}
catch (Exception e){
e.printStackTrace();
}
return null;
}
}
'HttpClient'是不提倡使用的方法它不再由Google維護。如果你使用'Retrofit',你可以切換到'HttpUrlConnection'或更好。 –
@ M.WaqasPervez哥哥我是初學者,所以要具體和儘可能容易,如何克服這個問題 –