This tutorial will show you how to load an image located on a url like “http://mywebsite.com/images/image.jpg”.
First your .xml file should look like this:

Now the main function where will call this image.xml layout will be called ImageFromWeb
and will call a certain image specified by us and it will be posted on the place setted by us in the image.xml file.
public class ImageFromWeb extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.image); ImageView image=(ImageView)findViewById(R.id.ImageView01); Drawable drawable = LoadImageFromWebOperations("http://mywebsite.com/images/image.jpg"); image.setImageDrawable(drawable); }/*as you can see there is a function used to load and make a drawable from a http link..so we need to make this function bellow*/ 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) { System.out.println("Exc="+e); return null; } }
This is the full code for loading an image from a webserver. For any clarifications please comment below.