現在我有一些類負責保存ListView中列出的內部存儲器位圖。存儲位圖的最佳方法
一經上市,再打,告訴圖像的名稱要返回並獲得相應的位圖什麼的方法。
應用程序啓動時,加載到內存中(HashMap的),你會需要,一旦你從內部存儲器直接加載圖像列表視圖中的所有圖像,這個過程需要很長的時間。
我使用的意見回收和每個項目有兩個和兩個imageviews textviews。然而,scrooll速度很慢,滯後很多。
這是一個很好的解決方案,讓圖像在內存(hashmap)?在列表更慢時加載到內存中。圖像有100x100像素。
我的問題是:我與滯後的問題可能與事實圖片都是在內存中做什麼?什麼是最好的解決方案?
編輯:
07-25 16:56:33.195: V/ADAPTER(8648): recicling view [1]
07-25 16:56:33.195: V/ADAPTER(8648): recicling view [2]
07-25 16:56:33.203: V/ADAPTER(8648): recicling view [3]
07-25 16:56:33.203: V/ADAPTER(8648): recicling view [4]
07-25 16:56:33.210: V/ADAPTER(8648): recicling view [5]
07-25 16:56:33.257: V/ADAPTER(8648): recicling view [16]
07-25 16:56:33.265: V/ADAPTER(8648): recicling view [15]
07-25 16:56:33.273: V/ADAPTER(8648): recicling view [14]
07-25 16:56:33.281: V/ADAPTER(8648): recicling view [0]
07-25 16:56:33.289: V/ADAPTER(8648): recicling view [1]
07-25 16:56:33.289: V/ADAPTER(8648): recicling view [2]
07-25 16:56:33.289: V/ADAPTER(8648): recicling view [3]
07-25 16:56:33.296: V/ADAPTER(8648): recicling view [4]
07-25 16:56:33.296: V/ADAPTER(8648): recicling view [5]
07-25 16:56:33.304: V/ADAPTER(8648): recicling view [6]
07-25 16:56:33.312: V/ADAPTER(8648): recicling view [7]
07-25 16:56:33.320: V/ADAPTER(8648): recicling view [0]
07-25 16:56:33.328: V/ADAPTER(8648): recicling view [1]
07-25 16:56:33.328: V/ADAPTER(8648): recicling view [2]
07-25 16:56:33.335: V/ADAPTER(8648): recicling view [3]
07-25 16:56:33.335: V/ADAPTER(8648): recicling view [4]
07-25 16:56:33.343: V/ADAPTER(8648): recicling view [5]
07-25 16:56:33.343: V/ADAPTER(8648): recicling view [6]
07-25 16:56:33.359: V/ADAPTER(8648): recicling view [0]
07-25 16:56:33.359: V/ADAPTER(8648): recicling view [1]
07-25 16:56:33.367: V/ADAPTER(8648): recicling view [2]
07-25 16:56:33.367: V/ADAPTER(8648): recicling view [3]
07-25 16:56:33.367: V/ADAPTER(8648): recicling view [4]
07-25 16:56:33.375: V/ADAPTER(8648): recicling view [5]
07-25 16:56:33.382: V/ADAPTER(8648): recicling view [6]
07-25 16:56:33.398: V/ADAPTER(8648): recicling view [0]
07-25 16:56:33.398: V/ADAPTER(8648): recicling view [1]
07-25 16:56:33.406: V/ADAPTER(8648): recicling view [2]
07-25 16:56:33.406: V/ADAPTER(8648): recicling view [3]
07-25 16:56:33.414: V/ADAPTER(8648): recicling view [4]
07-25 16:56:33.414: V/ADAPTER(8648): recicling view [5]
07-25 16:56:33.484: V/ADAPTER(8648): recicling view [13]
07-25 16:56:33.492: V/ADAPTER(8648): recicling view [0]
07-25 16:56:33.500: V/ADAPTER(8648): recicling view [1]
07-25 16:56:33.500: V/ADAPTER(8648): recicling view [2]
07-25 16:56:33.507: V/ADAPTER(8648): recicling view [3]
07-25 16:56:33.507: V/ADAPTER(8648): recicling view [4]
07-25 16:56:33.507: V/ADAPTER(8648): recicling view [5]
07-25 16:56:33.515: V/ADAPTER(8648): recicling view [6]
07-25 16:56:33.523: V/ADAPTER(8648): recicling view [7]
07-25 16:56:33.531: V/ADAPTER(8648): recicling view [0]
07-25 16:56:33.539: V/ADAPTER(8648): recicling view [1]
07-25 16:56:33.539: V/ADAPTER(8648): recicling view [2]
07-25 16:56:33.546: V/ADAPTER(8648): recicling view [3]
07-25 16:56:33.546: V/ADAPTER(8648): recicling view [4]
07-25 16:56:33.554: V/ADAPTER(8648): recicling view [5]
07-25 16:56:33.554: V/ADAPTER(8648): recicling view [6]
07-25 16:56:33.562: V/ADAPTER(8648): recicling view [0]
07-25 16:56:33.570: V/ADAPTER(8648): recicling view [1]
07-25 16:56:33.578: V/ADAPTER(8648): recicling view [2]
07-25 16:56:33.578: V/ADAPTER(8648): recicling view [3]
07-25 16:56:33.578: V/ADAPTER(8648): recicling view [4]
07-25 16:56:33.585: V/ADAPTER(8648): recicling view [5]
07-25 16:56:33.585: V/ADAPTER(8648): recicling view [6]
07-25 16:56:33.609: V/ADAPTER(8648): recicling view [0]
07-25 16:56:33.609: V/ADAPTER(8648): recicling view [1]
07-25 16:56:33.617: V/ADAPTER(8648): recicling view [2]
07-25 16:56:33.617: V/ADAPTER(8648): recicling view [3]
07-25 16:56:33.625: V/ADAPTER(8648): recicling view [4]
07-25 16:56:33.625: V/ADAPTER(8648): recicling view [5]
07-25 16:56:33.679: V/ADAPTER(8648): recicling view [12]
07-25 16:56:33.687: V/ADAPTER(8648): recicling view [0]
07-25 16:56:33.695: V/ADAPTER(8648): recicling view [1]
07-25 16:56:33.695: V/ADAPTER(8648): recicling view [2]
07-25 16:56:33.703: V/ADAPTER(8648): recicling view [3]
07-25 16:56:33.703: V/ADAPTER(8648): recicling view [4]
07-25 16:56:33.710: V/ADAPTER(8648): recicling view [5]
07-25 16:56:33.710: V/ADAPTER(8648): recicling view [6]
07-25 16:56:33.718: V/ADAPTER(8648): recicling view [7]
07-25 16:56:33.734: V/ADAPTER(8648): recicling view [0]
07-25 16:56:33.734: V/ADAPTER(8648): recicling view [1]
07-25 16:56:33.742: V/ADAPTER(8648): recicling view [2]
07-25 16:56:33.742: V/ADAPTER(8648): recicling view [3]
07-25 16:56:33.750: V/ADAPTER(8648): recicling view [4]
07-25 16:56:33.750: V/ADAPTER(8648): recicling view [5]
07-25 16:56:33.757: V/ADAPTER(8648): recicling view [6]
07-25 16:56:33.765: V/ADAPTER(8648): recicling view [0]
07-25 16:56:33.773: V/ADAPTER(8648): recicling view [1]
07-25 16:56:33.773: V/ADAPTER(8648): recicling view [2]
07-25 16:56:33.773: V/ADAPTER(8648): recicling view [3]
07-25 16:56:33.781: V/ADAPTER(8648): recicling view [4]
07-25 16:56:33.781: V/ADAPTER(8648): recicling view [5]
07-25 16:56:33.789: V/ADAPTER(8648): recicling view [6]
07-25 16:56:33.804: V/ADAPTER(8648): recicling view [0]
07-25 16:56:33.812: V/ADAPTER(8648): recicling view [1]
07-25 16:56:33.812: V/ADAPTER(8648): recicling view [2]
07-25 16:56:33.812: V/ADAPTER(8648): recicling view [3]
07-25 16:56:33.820: V/ADAPTER(8648): recicling view [4]
07-25 16:56:33.820: V/ADAPTER(8648): recicling view [5]
07-25 16:56:33.875: V/ADAPTER(8648): recicling view [0]
07-25 16:56:33.882: V/ADAPTER(8648): recicling view [1]
07-25 16:56:33.890: V/ADAPTER(8648): recicling view [2]
07-25 16:56:33.890: V/ADAPTER(8648): recicling view [3]
07-25 16:56:33.898: V/ADAPTER(8648): recicling view [4]
07-25 16:56:33.898: V/ADAPTER(8648): recicling view [5]
07-25 16:56:33.906: V/ADAPTER(8648): recicling view [6]
07-25 16:56:33.914: V/ADAPTER(8648): recicling view [7]
07-25 16:56:33.929: V/ADAPTER(8648): recicling view [0]
07-25 16:56:33.929: V/ADAPTER(8648): recicling view [1]
07-25 16:56:33.937: V/ADAPTER(8648): recicling view [2]
07-25 16:56:33.937: V/ADAPTER(8648): recicling view [3]
07-25 16:56:33.945: V/ADAPTER(8648): recicling view [4]
07-25 16:56:33.953: V/ADAPTER(8648): recicling view [5]
07-25 16:56:33.953: V/ADAPTER(8648): recicling view [6]
07-25 16:56:33.968: V/ADAPTER(8648): recicling view [0]
07-25 16:56:33.976: V/ADAPTER(8648): recicling view [1]
07-25 16:56:33.976: V/ADAPTER(8648): recicling view [2]
07-25 16:56:33.976: V/ADAPTER(8648): recicling view [3]
07-25 16:56:33.984: V/ADAPTER(8648): recicling view [4]
07-25 16:56:33.984: V/ADAPTER(8648): recicling view [5]
07-25 16:56:33.992: V/ADAPTER(8648): recicling view [6]
07-25 16:56:34.007: V/ADAPTER(8648): recicling view [0]
07-25 16:56:34.015: V/ADAPTER(8648): recicling view [1]
07-25 16:56:34.015: V/ADAPTER(8648): recicling view [2]
07-25 16:56:34.015: V/ADAPTER(8648): recicling view [3]
07-25 16:56:34.023: V/ADAPTER(8648): recicling view [4]
07-25 16:56:34.031: V/ADAPTER(8648): recicling view [5]
每當我滾動(不勝枚舉),我得到這個輸出。 []內的內容對應於該位置。他不斷地表現出0-6的位置是不是很奇怪?
編輯
現在發現了一個可能的原因。
我目前是一個tab_activity,在那裏有所有必要的意見。 在xml中添加了一個tab_activity top_bar,我有一個不斷被更改的圖像。當圖像處於自動模式(不斷更改)時,選項卡中的ListView會「重新繪製」,因此會出現延遲。
我正在使用x時間更改x圖像的服務(音樂)。
爲什麼當我查看圖像重新繪製列表視圖進行重新繪製?
做你的形象有較大的文件的大小?他們是否支持優化格式?建議使用.png文件 – 2012-07-25 15:52:34
fos = openFileOutput(name,Context.MODE_PRIVATE); bitmap.compress(CompressFormat.JPEG,90,fos);我用JPEG來保存圖像,它的錯誤?我使用:bitmap = BitmapFactory.decodeStream(fis);從內部存儲中獲取映像 – marceloamx 2012-07-25 16:00:08