As a first step maybe pull the downloaded file off the /sdcard/ using
adb and compare it to the file you think is on the server to make sure
you are getting what you expected.

On Nov 11, 7:03 am, mudit <[email protected]> wrote:
>   0  vote down  star
>
> hi. i am downloading files from web server programatically. after
> download is complete, i checked the file.the size ,extension and all
> other parameters are correct but i when i try to play that file in
> media player it is showing that it is corrupt.
>
> plz help..
>
> code:
>
> byte[] b = null;
> InputStream in = null;
> b = new byte[Integer.parseInt(size)];    // size of the file.
> in = OpenHttpConnection(URL);
> in.read(b);
> in.close();
>
> File folder = new File("/sdcard", "folder");
>
> boolean check = folder.mkdirs();
>
> Log.d("HttpDownload", "check " + check);
>
> File myFile = new File("/sdcard/folder/" + name);
>
> myFile.createNewFile();
>
> OutputStream filoutputStream = new FileOutputStream(myFile);
>
> filoutputStream.write(b);
>
> filoutputStream.flush();
>
> filoutputStream.close();

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to