. Try follwing code you will not need to refresh... nd put your image url into inputurl variable InputStream is = null; String inputurl = " Enter url of your image "; try { URL url = new URL(inputurl); Object content = url.getContent(); is = (InputStream) content; avatar = Drawable. CreateFromStream(is,"src"); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } ImageView image = new ImageView(this); LinearLayout.
LayoutParams vp = new LinearLayout. LayoutParams(LayoutParams. FILL_PARENT, LayoutParams.
FILL_PARENT); image. SetLayoutParams(vp); image. SetScaleType(ImageView.ScaleType.
CENTER_CROP); image. SetMaxHeight(50); image. SetMaxWidth(50); image.
SetImageDrawable(avatar); theLayout. AddView(image).
You can use another thread to download the image, and after download finishes you can update the drawable by using a handler. You can see how to make another thread at the documentation. It does not seems easy but it would be better to learn how to do it, if you want to build more responsive android apps.(title) Example ProgressDialog with a second thread developer.android.com/guide/topics/ui/di....
I think you have to deifne the parameters for the vp if you will define parameters it will display the image like- LinearLayout. LayoutParams Params=new LinearLayout. LayoutParams(LayoutParams.
FILL_PARENT,LayoutParams. WRAP_CONTENT); Params. SetMargins(0,0,0,0); Params=new LinearLayout.
LayoutParams(LayoutParams. FILL_PARENT,LayoutParams. WRAP_CONTENT).
I'm trying to download an image, and create an ImageView dynamically and add it to my layout, but it won't display the image. Maybe I need to refresh the layout after I add the ImageView? How do you "refresh"?
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.