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