public static Bitmap GetImage (String Url) throws Exception {
try {
URL url = new url (URL);
String responsecode = Url.openconnection (). Getheaderfield (0);
if (Responsecode.indexof ("M") < 0)
throw new Exception ("Picture file does not exist or path error, error code:" + responsecode);
Return Bitmapfactory.decodestream (Url.openstream ());
catch (IOException e) {
TODO auto-generated Catch block
throw new Exception (E.getmessage ());
}
}
This class returns a Bitmap object,
The following is a simple call to a class:
Directly on the code:
Bitmap Mbitmap;
Get Pictures directly:
private void Refreshdb () {
try {
Sendmsg (Declare.start, "Loading pictures ...");
Mbitmap = downfile.getimage (picture address);
Sendmsg (Declare.stop, "");
catch (Exception e) {
TODO auto-generated Catch block
Sendmsg (Declare.error, E.getmessage ());
}
Here with a simple scroll bar, indicating that the current program is executing, through the way of sending a message, the specific no longer write, that message headless this core code implementation.
To execute after the load completes:
Mimageview1.setimagebitmap (MBITMAP);