The problem looks like careless copy & paste errors - you're trying to add buttons that are null because you're creating a new 'add' button every time, instead of the buttons you should be creating.