私は別のプロジェクトからコピーしていたコードを持っています。これにより、URLを渡すことができ、画像が返されます...次に、画像ビューに設定すると画像が表示されます...しかし、どこかで...取得した画像が表示されなくなりました...このコードを見て、何か問題があるかどうか教えてもらえますか?
クリックイベント
void NextPic(View v)
{
picNum++; //int holding what pic number we are on
Drawable bPic = LoadImageFromWebOperations(picData[]); //picData = String[] with url data in it
imgView.setImageDrawable(bPic); //Cast earlier in the code
}
Get Pic 関数
private Drawable LoadImageFromWebOperations(String url)
{
try
{
InputStream is = (InputStream) new URL(url).getContent();
Drawable d = Drawable.createFromStream(is, "src name");
return d;
}
catch(Exception e)
{
//Custom error handler
uu.SendError(e.getMessage(), "Main.GetPickTask.LoadImageFromWeboperations(String url)");
return null;
}
}
LogCat には何も表示されません...エラーは発生しません...そして、写真は空白のままです... ic_launcher グラフィックをプレースホルダーとして使用したので、それがイメージビュー自体であるかどうかを確認してください...しかし、それが表示されます数秒後に黒くなります
これは、私が使用している URL の例です http://app.guycothal.com/Funnys/2012722133515231.jpg