开发者

image display from servlet

I need to display image from servlet to my android applic开发者_运维问答ation how can i do it please some one help me thanks in advance


I would suggest following steps:

  1. Use AsyncTask to download image from the servlet asynchronously, save it to file (either in memory or on memory card)
  2. In activity, place ImageView where you want image to be shown.
  3. Convert loaded image to bitmap:

FileInputStream fis;
Bitmap image;
try {
fis = new FileInputStream("path to downloaded image");
Bitmap image = BitmapFactory.decodeStream(fis);
} catch (FileNotFoundException e) {
// handle exception
}

4. Set bitmap to ImageView.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜