Lazygeek Lazygeek
Title

HTTP

Acquisition de données depuis Internet par l’utilisation de requêtes HTTP

Déclarer la permission ds le manifest

<uses-permission android:name="android.permission.INTERNET" />

Téléchargement

try {
    URL url = new URL(urlString);
    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
    InputStream stream = connection.getInputStream();
}
catch (Exception ex) {     // Exception management to handle any error that can occur during http request
    throw new RuntimeException(ex);
}