2012-05-12 6 views
0

이 문제가 있으며 여기에 뭔가 빠졌습니다. 내 프로젝트는 FTP 서버에 액세스하여 특정 이미지를 다운로드해야하지만 사용중인 코드가 작동하지 않는 것처럼 보입니다. 동일한 코드를 사용하여 일부 텍스트 파일을 다운로드하는 중이며 잘 작동합니다.FTP 서버에서 이미지를 다운로드 할 수 없습니다.

* 참고 : 아파치 평민 ftpclient를 사용하고 .. 나는 또한이 시도

try { 
     File Imgfile = new File(Environment.getExternalStorageDirectory(), "img.jpg"); 
     BufferedOutputStream buffIn = new BufferedOutputStream(new FileOutputStream(Imgfile)); // local location 
     con.retrieveFile("/public_html/cam.jpg", buffIn); 
     buffIn.close(); 
    } catch (IOException e) { 
     Toast customToast = new Toast(getBaseContext()); 

      customToast = Toast.makeText(getBaseContext(), "Cannot Downlaod the image" , Toast.LENGTH_SHORT); 
      customToast.setGravity(Gravity.TOP|Gravity.LEFT, 150, 450); 
      customToast.show(); 
    } 

: 여기

내 코드입니다 난 항상이 시도 할 수

InputStream Fstream = null; 
    try { 
      Fstream = con.retrieveFileStream("/public_html/out.jpg"); 
      bitmap = BitmapFactory.decodeStream(Fstream); 
         FileOutputStream stream = new FileOutputStream(mFilePath); 
         bitmap.compress(CompressFormat.JPEG, 100, stream); 
        stream.flush(); 
        stream.close(); 

      buffIn.flush(); 
      buffIn.close(); 
     Fstream.close(); 
    } catch (IOException e) { 
     Toast customToast = new Toast(getBaseContext()); 

      customToast = Toast.makeText(getBaseContext(), "Cannot Downlaod the image" , Toast.LENGTH_SHORT); 
      customToast.setGravity(Gravity.TOP|Gravity.LEFT, 150, 450); 
      customToast.show(); 
    } 

/메시지 잡기 "이미지를 축소 할 수 없음",

제발 날 잘못했거나 올바른 방향으로 나를 가리켜주세요. 사전에

감사

답변

0

다운로드 및 디스플레이 이미지에 see this 완전한 예 ....

void downloadBitmapImage() 
{ 
} 
관련 문제