Just as we assigned a value to our reference in our rocks, we will do the same for both our boundaries. We will do so in our surfaceCreated() method by adding the variables marked in bold:
@Override public void surfaceCreated(SurfaceHolder holder){upperBoundary = new ArrayList<UpperBoundary>(); lowerBoundary = new ArrayList<LowerBoundary>(); }
Looks neat! Now comes the tricky part. We will have to write the update logic for both our boundaries. Don't confuse this with the update() method in our individual boundaries. That update method will simply make our ground move backward. We will also need to actually write the logic to spawn them on screen. Let's see how to do that.