I Founded my problem in this post Updating ExpandableListView with notifyDataSetChanged()
“each time you refresh the the views using setNotifyDatasetChanged the Adapter will call the loop around the List. and you List in the Adapter gets a null value due to the changes you made.”
I am beginner and can not properly make changes to the list
my sources
public class UrlArrayAdapter extends ArrayAdapter<UrlItem> {
private LayoutInflater inflater;
private ListView urlListView1;
private ArrayList<UrlItem> urlItems1;
public UrlArrayAdapter(Context context, ListView urlListView,
ArrayList<UrlItem> urlLists) {
super(context, urlListView.getId(), urlLists);
this.urlItems1 = urlLists;
this.urlListView1 = urlListView;
inflater = LayoutInflater.from(context);
how do I remove an item from the list in urlLists in the base adapter??
In addition to overriding
public View getView(int position, View view, ViewGroup parent), make sure your class that extendsArrayAdapteroverrides these methods:I believe
notifyDataSetChanged()will callgetCount()on your adapter to determine how many items there are. If you don’t override this method withreturn urlItems1.size();then anIndexOutOfBoundExceptionseems imminent because there will be no way for your custom adapter to tell clients about its size and contents.