i have this class which extends BaseAdapter
that i use to insert an icon and a textView
for each row of a listView that is inside a drawer
public class NavRightDrawerListAdapter extends BaseAdapter {
private Context context;
LinkedList<String> userNameUsedForListView;
Map<String, Bitmap> urlUserImage;
public NavRightDrawerListAdapter(Context context, LinkedList<String> userNameUsedForListView, Map<String, Bitmap> returnBitMapFromURL) {
this.context = context;
this.userNameUsedForListView = userNameUsedForListView;
this.urlUserImage = returnBitMapFromURL;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
int count = 0;
if (convertView == null) {
LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
convertView = mInflater.inflate(R.layout.drawer_list_of_action, null);
}
ImageView imgIcon = (ImageView) convertView.findViewById(R.id.icon);
TextView txtTitle = (TextView) convertView.findViewById(R.id.title);
imgIcon.setImageBitmap(urlUserImage.get(userNameUsedForListView.get(count)));
txtTitle.setText(userNameUsedForListView.get(count));
count++;
return convertView;
}
@Override
public int getCount() {
return userNameUsedForListView.size();
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
my list size is 1, and getView is called 1 time,normally, but getCount is called six times? why? is a normal behaviour?
i didn't implement the method,getItem()
and getItemId()
,because i don't need them, i have to implement them anyway?
thanks a lot.