次のように、NameValuePair の値として Hashtable を追加します。
name= credit_card
value(this is the hashtable)= {expirationDate="2013/02/18", ownerName="Jack Sparrow", typeOfCard="C2"}
またはこのように:
new BasicNameValuePair("credit_card",{expirationDate="2013/02/18", ownerName="Jack Sparrow", typeOfCard="C2"})。
これは私のコードの一部であり、単純な NameValuePair を追加する方法を確認できます。
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost("https://example.com/register");
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("user", user));
nameValuePairs.add(new BasicNameValuePair("password", password));
post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = client.execute(post);
前もって感謝します!