How do I dynamically update a spinner using ArrayList?
问题 I have created a Spinner that is populated with an ArrayList . I want to dynamically add values to the ArrayList , so the the Spinner populates dynamically. However, when I try to add values to my ArrayList , I get a NullPointerException . What am I missing? Do I have to reset the adapter before amending the ArrayList ? Here is my code: My spinner, arraylist, and adapter: deleteselection = (Spinner)view.findViewById(R.id.deletespinner); portfoliosdelete = new ArrayList<String>();