안드로이드 개발 질문/답변
(글 수 45,052)
안녕하세요.
app 개발중에 잘 되지 않는것이 있어서..
질문 드립니다.
서버에 있는 이미지나, 동영상을 로컬 sdcard에 저장하려고 하는데..
잘 되지가 않네요..
File f = new File( "/sdcard/11.mp4");
FileOutputStream out = null;
String strUrl = "http://www.saturn.dti.ne.jp/~npaka/android/sample.mp4";
InputStream is = null;
try {
out = new FileOutputStream(f);
URL url = new URL(strUrl);
URLConnection connection = url.openConnection();
HttpURLConnection httpConnection = (HttpURLConnection)connection;
int nSize = httpConnection.getContentLength();
...........}
nSize 가 -1이 리턴 됩니다.
위와 같은 방식으로 하면 안되는 겁니까?
받아와서 sdcard에 저장하려 하는데... 저기부터 막히니 방법이..
답변 부탁드려효~~~~
app 개발중에 잘 되지 않는것이 있어서..
질문 드립니다.
서버에 있는 이미지나, 동영상을 로컬 sdcard에 저장하려고 하는데..
잘 되지가 않네요..
File f = new File( "/sdcard/11.mp4");
FileOutputStream out = null;
String strUrl = "http://www.saturn.dti.ne.jp/~npaka/android/sample.mp4";
InputStream is = null;
try {
out = new FileOutputStream(f);
URL url = new URL(strUrl);
URLConnection connection = url.openConnection();
HttpURLConnection httpConnection = (HttpURLConnection)connection;
int nSize = httpConnection.getContentLength();
...........}
nSize 가 -1이 리턴 됩니다.
위와 같은 방식으로 하면 안되는 겁니까?
받아와서 sdcard에 저장하려 하는데... 저기부터 막히니 방법이..
답변 부탁드려효~~~~



