Hey Casey and James thank YOU VERY MUCH for your responses! I fact I used this ...
static class ViewHolder {
TextView text;
ImageView icon;
}
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.list_item_icon_text, null);
holder = new ViewHolder();
holder.text = (TextView) convertView.findViewById(R.id.text);
holder.icon = (ImageView) convertView.findViewById(R.id.icon);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.text.setText(DATA[position]);
holder.icon.setImageBitmap((position & 1) == 1 ? mIcon1 : mIcon2);
return convertView;
}
from Turbo-Chargeyour UI
but in my case I have to use 3 different views in my ListView! at position 0, at position 5 and another in the other positions...
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
convertView = null;
//****FORCING TO CREATE EVERYTIME A DIFFERENT VIEW! ( I USE 3 DIFERENT TYPES OF VIEWS)
if (convertView == null) {
if (position == 0) {
LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = vi.inflate(R.layout.iconrowmain, null);
} else if (position == 5) {
LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = vi.inflate(R.layout.iconrowwebadvice, null);
} else {
LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = vi.inflate(R.layout.iconrowa, null);
}
}
this makes so slow my app! :( creating everytime a new View :(
If I have already created all my views how could avoid enter again in getView() function when I do the scrolling!????
THANK YOU VERY MUCH!
Alexi
P.S. OK JAMES! SIMPLE CACHE!!! :D