Bonjour,
J'utilise le code suivant pour récupérer le contenu d'un fichier XML à partir d'un URL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| // Create a new HttpClient and Post Header
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
try {
// Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("id", "12345"));
nameValuePairs.add(new BasicNameValuePair("stringdata", "AndDev is Cool!"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
HttpResponse response = httpclient.execute(httppost);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
} catch (IOException e) {
// TODO Auto-generated catch block
} |
mais dans mon code j'obtiens une erreur
sur la ligne
List <NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
Il me souligne le mot List
Comment je peux la corriger ?
Merci d'avance pour votre aide.
Partager