나는 게임을 만들기 시작했다.이 게임은 서버에서 이미지를 얻는다.URL에서 이미지
비트 맵을 사용하여 이미지 * S * 및 그 작품을 천천히 변환합니다.
22 이미지 (각 이미지 당 100KB)를로드하는 데 25-40 초가 걸립니다.
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을 사용하고, 내 목표를 위해 아니다.
다른 혜택이 더 있습니까? BitmatpFactory
공장은 항상 데이터를 수집하기 위해 입력 스트림 기다려야했다 그래서 그것의, BitmatpFactory
를 사용하여 디코딩 동안
TNX ....
http://stackoverflow.com/questions/2471935/how-to-load-an-imageview-by- url-in-android –