We address the solution of time-varying optimization problems characterized by the sum of a time-varying strongly convex function and a time-invariant nonsmooth convex function. We design an online algorithmic framework based on prediction-correction, which employs splitting methods to solve the sampled instances of the time-varying problem. We describe the prediction-correction scheme and two splitting methods, the forward-backward and the Douglas-Rachford. Then by using a result for generalized equations, we prove convergence of the generated sequence of approximate optimizers to a neighborhood of the optimal solution trajectory. Simulation results for a leader following formation in robotics assess the performance of the proposed algorithm.