i have this url http://app.oviewz.com/proceso_seleccions/110.png?style=medium&token=q9W0BQpU. when u put on any web browser automatically download the file but when i try to download by using this android code:
String urllogo="http://app.oviewz.com/proceso_seleccions/110.png?style=medium&token=q9W0BQpU";
URL url = new URL(urllogo);
HttpURLConnection urlConnection = (HttpURLConnection) url
.openConnection();
urlConnection.setRequestMethod("GET");
urlConnection.setDoOutput(true);
// <span id="IL_AD2" class="IL_AD">connect</span>
urlConnection.connect();
// set the path where we want to save the file
File SDCardRoot = Environment.getExternalStorageDirectory();
// create a new file, to save the <span id="IL_AD7"
// class="IL_AD">downloaded</span> file
File file = new File(SDCardRoot, "logo.jpg");
FileOutputStream fileOutput = new FileOutputStream(file);
// Stream used for reading the data from the internet
InputStream inputStream = urlConnection.getInputStream();
// this is the total size of the file which we are <span
// id="IL_AD12" class="IL_AD">downloading</span>
// create a buffer...
byte[] buffer = new byte[1024];
int bufferLength = 0;
while ((bufferLength = inputStream.read(buffer)) > 0) {
fileOutput.write(buffer, 0, bufferLength);
}
// close the output stream when complete //
fileOutput.close();
is raised FileNotFoundException. anyone can help me what i'm doing wrong?