Descargue el archivo de la web usando DefaultHttpClient [cerrado]
Frecuentes
Visto 860 veces
1 Respuestas
0
Puedo dar un ejemplo que te ayuda definitivamente HttpClient httpclient = new DefaultHttpClient();
// Prepare a request object
HttpGet httpget = new HttpGet("http://www.apache.org/");
// Execute the request
HttpResponse response = httpclient.execute(httpget);
// Examine the response status
System.out.println(response.getStatusLine());
// Get hold of the response entity
HttpEntity entity = response.getEntity();
// If the response does not enclose an entity, there is no need
// to worry about connection release
if (entity != null) {
InputStream instream = entity.getContent();
try {
BufferedReader reader = new BufferedReader(
new InputStreamReader(instream));
// do something useful with the response
System.out.println(reader.readLine());
} catch (IOException ex) {
// In case of an IOException the connection will be released
// back to the connection manager automatically
throw ex;
} catch (RuntimeException ex) {
// In case of an unexpected exception you may want to abort
// the HTTP request in order to shut down the underlying
// connection and release it back to the connection manager.
httpget.abort();
throw ex;
} finally {
// Closing the input stream will trigger connection release
instream.close();
}
// When HttpClient instance is no longer needed,
// shut down the connection manager to ensure
// immediate deallocation of all system resources
httpclient.getConnectionManager().shutdown();
}
contestado el 21 de mayo de 12 a las 12:05
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas android or haz tu propia pregunta.
¿Esta imagen proviene de su servidor? En caso afirmativo, solicite enviarlo como valor de cadena base64 y convertir esa cadena base64 en imagen en su aplicación: dinesh sharma