私の Android アプリケーションでは、okHttpライブラリを使用しています。okhttp ライブラリを使用してサーバー (api) にパラメーターを送信するにはどうすればよいですか? 現在、次のコードを使用してサーバーにアクセスしていますが、okhttp ライブラリを使用する必要があります。
これは私のコードです:
httpPost = new HttpPost("http://xxx.xxx.xxx.xx/user/login.json");
nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("email".trim(), emailID));
nameValuePairs.add(new BasicNameValuePair("password".trim(), passWord));
httpPost = new HttpPost(url);
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
String response = new DefaultHttpClient().execute(httpPost, new BasicResponseHandler());