Skip to content Skip to sidebar Skip to footer

The Getview() Method Of Arrayadapter Is Not Getting Called

I am very new to android development. I am trying to a build an application with tags (which are added through fragments). In one of the fragments, I am trying to display a list. T

Solution 1:

You just forgot to provide the data to the constructor and then make the correct call within the constructor:

publicListViewAdapter(Context context,int resource, int textViewResourceId, List<YourObjectType> items) {
    super(context,resource,textViewResourceId, items);
    this.context1 = context;
    // TODO Auto-generated constructor stub
}

Solution 2:

You are not supplying any data to it currently. If you still want to see whats happening in the list, override the getCount() function.

I think it is something of this sort.

publicintgetCount(){
    return1;
}

This will draw one item in your list. And also call your getView(). And ya once you find out how to supply your data source, change the getCount() to the size of you list. Check out a tutorial here

http://www.shubhayu.com/android/listview-with-arrayadapter-and-customized-items

Solution 3:

When we are creating a custom arrayadapter we must be using either

publicArrayAdapter(Context context, int textViewResourceId, T[] objects)publicArrayAdapter(Context context, int resource, int textViewResourceId, T[] objects)publicArrayAdapter(Context context, int textViewResourceId, List<T> objects)publicArrayAdapter(Context context, int resource, int textViewResourceId, List<T> objects)

if we are not using above mention adapter, we need to override getCount() method.

Solution 4:

it looks like you haven't specified a data source for your adapter. A data source is any thing which provides data to be displayed , for ex an arraylist or a cursor. If there is no data from a data source, getview() wont be called at all.

Solution 5:

  adapter.notifyDataSetChanged();
  lv.setAdapter(adapter);

swap the positions

Layoutinflator=getLayoutInflator();

Post a Comment for "The Getview() Method Of Arrayadapter Is Not Getting Called"