Solved NullPointerException in getNumberOfItems method