次のコードを使用して、パブリック共有画像をGoogleドライブからAndroidアプリにロードしていますが、次のコードが表示されることがあります。
javax.net.ssl.SSLException: Read error: ssl=0x1d9ed0: I/O error during system call, Connection reset by peer
画像をダウンロードする前にGoogleドライブが接続を閉じているのはなぜですか?これはランダムに発生していますが、かなり頻繁に発生します。誰かがそのような問題と衝突しますか?
public static InputStream getStream(String url)
{
InputStream is = null;
try
{
is = new URL(url).openConnection().getInputStream();
} catch (MalformedURLException e)
{
L.e(e.toString());
} catch (IOException e)
{
L.e(e.toString());
}
return is;
}
ビットマップの読み込みには、単純なコードを使用します。
BitmapFactory.decodeStream(stream, null, null);