Faster loading ListView, faster than the Viewholder method
android, android-listview
Solution
You can try this, not sure if it will speed up, but give it a shot.
Inflate the layout in a background thread.
View getView(int position, View convertView, ...) {
View v;
if (convertView == null) {
Start a background thread to inflate your linearLayout.
Pass item data and view 'v' to it.
v = inflate a simple dummy textview;
return v;
}
set normal stuff to convertview here.
return convertView ;
}
In the background thread,
- Inflate your Linearlayout into `'v'`
- Set all the data.
Then invalidate the view `v`.
v.postInvalidate();
Problem
When inflating views for a listView, is it better to have all textViews without android:text in the .xml file and how much does that affects the speed? What about ViewStubs, would that be even faster? When inflating a LinearLayout with 8 textViews without android:text and with android:text="@string/abc", does that change anything ? note that i am reusing views, so maybe only 10 get inflated and then reused i don't know. I am developing on a ZTE Blade, so that'a single 600Mhz CPU and not a quad core ...