1
我開始構建一款遊戲,這款遊戲從服務器獲取圖片。圖片來自URL
我用位圖轉換圖像* S *及其作品緩慢。
及其採取25 - 40秒的負載22倍的圖像(100KB爲每個圖像)。
public static Bitmap getBitmapFromURL(String src) {
try {
URL url = new URL(src);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
return myBitmap;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
實現:
Bitmap pictureBitmap = ImageFromUrl.getBitmapFromURL(path);
PS ..
我之前使用LazyList,這不是我的目標。
更多供應信息?
TNX ....
你可以參考這個鏈接http://stackoverflow.com/questions/2471935/how-to-load-an-imageview-by-網址功能於安卓 –