I am using UrlImageViewHelper in order to load pictures in an adapterview.
My adapter is:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if(convertView==null){
convertView=new SquaredImageView(getContext());
}
SquaredImageView view= (SquaredImageView) convertView;
final long time=System.currentTimeMillis();
UrlImageViewHelper.setUrlDrawable(view,getItem(position).getLook_picture(),
R.drawable.placeholder_bkp, -1,new UrlImageViewCallback() {
@Override
public void onLoaded(ImageView imageView, Bitmap loadedBitmap,
String url, boolean loadedFromCache) {
Log.d(TAG,"time : "+ (System.currentTimeMillis()-time));
}
});
return view;
}
I am downloading and displaying large pictures (620x620 jpg) in a full width list. They are slow the first time it is downloaded/displayed. This problem is not anymore occuring after an upgrade to android 4.2. on HTC one.
I tried to profile the calls and I believe that during the very long calls, it hangs reading the socket inputstream.
Has anyone a clue as to why there is such a difference in performance between the two platforms?
Logcat outputs: (timings under 100 ms are usually duplicates)
android 4.1.2 Galaxy SIII mini
- time : 3217
- time : 4782
- time : 124
- time : 56
- time : 168
- time : 84
- time : 102
- time : 2819
- time : 2703
- time : 154
- time : 2468
- time : 81
- time : 40
- time : 52
- time : 2495
- time : 37
- time : 2007
- time : 58
- time : 38
- time : 119
- time : 80
- time : 44
- time : 2419
- time : 1651
- time : 40
- time : 2766
- time : 90
- time : 1889
- time : 183
- time : 2515
- time : 58
- time : 3345
- time : 2661
- time : 81
- time : 2434
- time : 119
mostly above 1.5 sec. user needs to scroll items one by one to see the picture
On android 4.3 nexus 4:
- time : 47
- time : 1111
- time : 154
- time : 46
- time : 124
- time : 115
- time : 150
- time : 201
- time : 332
- time : 366
- time : 450
- time : 82
- time : 167
- time : 81
- time : 150
- time : 224
- time : 224
- time : 143
- time : 185
- time : 66
- time : 183
- time : 66
- time : 218
- time : 98
- time : 169
- time : 49
- time : 148
- time : 65
- time : 64
- time : 60
- time : 169
- time : 51
consistently under 500 ms, list is usable
This has nothing to do with the OS running on the phone. The probable reason and the most possible one is the amount of RAM memory that is being consumed by other applications on the device. For testing purposes try running the same code on a new device that has not many apps running on it..