I have a list userSubs (which I access with dm.theUser.getAllSubmissions
) of items called Submission and a draft submission I call tempSub that is not in that list. I have a list view where I want to display all the items in userSubs and the tempSub.
I create a temporary ArrayList called toDisplay and add all of the items in userSubs and then append tempSub. I then pass toDisplay into my arrayAdapter. That works fine. But when I press back and the page reloads, my tempSub has somehow been added to userSubs... a thorough search of my own and an "find in path" search reveals that I never call the userSubs.add() function.
ArrayList<Submission> toDisplay = new ArrayList<>();
toDisplay = dm.theUser.getAllSubmissions();
if(dm.tempSub.draftCreated) {
toDisplay.add(dm.tempSub);
}
saa = new submissionArrayAdapter(userSubmissions.this, toDisplay.toArray(
new Submission[toDisplay.size()]));
Here is some of the array adapter code.
private final Activity context;
private Submission[] submissions;
//constructor
public submissionArrayAdapter(Activity context, Submission[] submissions) {
super(context, R.layout.user_submission_row, submissions);
this.context = context;
this.submissions = submissions;
}
Any ideas on how tempSub is being added to userSubs?