There is no indication how soon after the bringing up of the ark these things occurred, but it was probably at no long interval.
Related Commentaries of 2 Samuel 7:1
2 Samuel 7:1
1 And it came to pass, when the king sat in his house, and the LORD had given him rest round about from all his enemies;