2012-05-12 10 views
0

この問題が発生しており、ここに何か不足していると思います。私のプロジェクトは、特定のイメージをダウンロードするためにFTPサーバーにアクセスする必要がありますが、コードが動作していないようですが、同じコードを使用してテキストファイルをダウンロードしています。FTPサーバーから画像をダウンロードできない

*注:Apacheのコモンズ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() 
{ 
} 
関連する問題