dear friends,
i am using following code to display remote image in my layout imageview
ImageView img;
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
img= (ImageView)findViewById(R.id.myImageView);
GetLiveImage();
setContentView(R.layout.imageviwer);
}
public void GetLiveImage()
{
// ImageView i = new ImageView(mycontext);
try {
URL aURL = new URL("http://www.abc.com/abc.jpg");
URLConnection conn = aURL.openConnection();
conn.connect();
InputStream is = conn.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
Bitmap bm = BitmapFactory.decodeStream(bis);
bis.close();
is.close();
// i.setImageBitmap(bm);
img.setImageBitmap(bm);
} catch (IOException e) {
}
// i.setScaleType(ImageView.ScaleType.FIT_CENTER);
// i.setLayoutParams(new Gallery.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
// return i;
}
but while calling setImageBitmap(bm) it gives me error
any one guide me how can i display remote image in my layout imageView?
any help would be appriciated.