Reputation: 1013
I've tried to refactor some code.. but now when I call setListAdapter() inside my fragment, it doesn't call the getView of the class loading the right view. I've even tried to use some custom adapter to make some test, but it doesn't log anything...
Any idea? Thanks! :)
setListAdapter(new ListAdapter(){
@Override
public int getCount() {
// TODO Auto-generated method stub
return 0;
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public int getItemViewType(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Log.i("LOG", "TEST");
return null;
}
@Override
public int getViewTypeCount() {
// TODO Auto-generated method stub
return 1;
}
@Override
public boolean hasStableIds() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isEmpty() {
// TODO Auto-generated method stub
return false;
}
@Override
public void registerDataSetObserver(DataSetObserver observer) {
// TODO Auto-generated method stub
}
@Override
public void unregisterDataSetObserver(DataSetObserver observer) {
// TODO Auto-generated method stub
}
@Override
public boolean areAllItemsEnabled() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isEnabled(int arg0) {
// TODO Auto-generated method stub
return false;
}
});
Upvotes: 0
Views: 713
Reputation: 896
If your adapter has item count=0 then it won't create any views.
@Override
public int getCount() {
// TODO Auto-generated method stub
return 0;
}
getCount must return number greater than 0 for list to call getView, and display view.
Upvotes: 1
Reputation: 9510
Here the problem is with the data which you are passing to the Adapter. if that array is empty or the size is 0 then getView will not get called.
Please check that from debugging the code or else give some static data for initial check
Upvotes: 0