Hello, I have a function that returns

ArrayList<HashMap<String, String>> 

There are several such functions and meta

I have to have several ArrayList<HashMap<String, String>> build one

 ArrayList<HashMap<String, String>> 

and then send this one ArrayList to BaseAdapter

Pesal following code

  ArrayList<HashMap<String, String>> getContacts = new ArrayList<>(); getContacts.addAll(...function name return arraylist....); getContacts.addAll(...function name return arraylist....); adapter = new Today_Adapter(getActivity(), getListView(), getContacts, Colors.getColors()); 

BUT Got the following error

  java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getImportantForAccessibility()' on a null object reference 
  • 2
    I see that either the adapter in getView returns null, or there is null in one of the returned lists, and you are somehow strangely processing it. getContacts , it may pop up. - zRrr
  • Yes, you were right. One of the functions returned a large null thanks - David Kern

1 answer 1

Perhaps your getListView() method returns null . Merging two ArrayList into one is yours.

  • This is not the reason for this error: java.lang.NullPointerException: Attempt to invoke interface method java.lang.Object [] java.util.Collection.toArray () Return arraylist ....); - David Kern
  • one
    @DavidKern Give the adapter code, something is wrong with your view - Yury Pashkov