Reputation: 1035
I am using DefaultHttpClient
to send data to web... To send data m using following code block:
nameValuePairs.add(new BasicNameValuePair(name, value));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
but namevaluepairs only take string.. I need to send integer value with this.
Please guide.. Thanks in advance.
Upvotes: 0
Views: 2745
Reputation: 11027
Use Integer.toString(integerValue)
. For example:
nameValuePairs.add(new BasicNameValuePair(name, Integer.toString(5)));
Edit, further to the comments below:
And for a float you can use:
nameValuePairs.add(new BasicNameValuePair(name, Float.toString(10.82522f)));
Upvotes: 1