I need to use some service.
The service method that i need to call need to get two parameters
1. int
2. some enum
I don’t know how to send those parameters and how to make this call.
I wanted to use this code
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("param1", val1);
nameValuePairs.add(new BasicNameValuePair("param2", val2);
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse p = httpclient.execute(httppost);
But this code can’t send int as parameter ( only string )
The second parameter ( that is some enum ) i think that i can send as string and the service in the other side will translate this string to enum ( am i right ? )
Use
String.valueOffor anintand thetoStringmethod of anEnum(which returns the name of theEnumas aString).How the server deals with this data depends on how it was coded.