Something like this should work:
URL url = new URL("http://www.yourdomain/your/path/image.jpg");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
final InputStream input = connection.getInputStream();
Bitmap yourpic = BitmapFactory.decodeStream(input);
However, a few clarifications:
This is a network operation, you'll have to run it in a
Thread
or anAsyncTask
I recommend using the above code just for testing purposes or for the case that the image is very small.
If you need to load more pics in background without interfering with the user's ability to interact with your app, I recommend using
Lazy Loading
. You may get more info here.