I have Looked around here on StackOverflow and the internet and tried a few things but all of them are giving me the same general problem.
I have an ArrayList that I create in one activity and then send it through (another activity or 2 others depending on the users choices) and in each activity (including the one that the arraylist is created in) has the user select a single button from a group. Upon selecting the button I have a listener that creates a simple string and then adds that String to the ArrayList, or at least that's what I want it to do.
- I have tried using
Serialized
classes to pass the same list through all the activities it needs to go through - I have tried making a new ArrayList in each class, copying the one from the previous class that was sent via an
intent.putExtra()
and then received so it could be copied into a new arraylist to do the same thing until it gets to the final Activity. - I have tried to make sense of
Parcleable
implementation but It just seems like to much for me (I'm not to good at this right now).
All of these have given me the same NullPointerException
whenever I try and use the .add()
method of the ArrayList (or the .addAll()
in terms of the second attempt to get this done.
Any suggestions along with explanations you would have to give to a beginner would be greatly appreciated! I can put code if needed!!