I'm trying to follow the answer to THAT question
But it seems that classes are not included with the default Android package since for that code:
File file = new File("FileToSend.txt");
HttpClient client = new HttpClient();
String url = "http://www.yourdomain.com/destination.php";
PostMethod postMethod = new PostMethod(url);
Part[] parts = {new FilePart(file.getName(), file)};
postMethod.setParameter("name", "value"); // set parameters like this instead in separate call
postMethod.setRequestEntity( new MultipartRequestEntity(parts, postMethod.getParams()));
int status = client.executeMethod(postMethod);
I have the following errors:
Cannot instantiate the type HttpClient
FilePart cannot be resolved to a type XXXXX.java
MultipartRequestEntity cannot be resolved to a type XXXXX.java
Part cannot be resolved to a type XXXXX.java
PostMethod cannot be resolved to a type XXXXX.java
How can I solve those errors, is there some library I must add? if yes please let me know how can I download it.
HttpClient
is (now) an interface. UseDefaultHttpClient
instead. Here's replacement classes for some of the others you listed: