I want to lock my application when it goes in background and when it resumes I want to display my own lock screen. The lock screen is an Activity of my application.
Aft
Your activity has an onResume() callback in its life cycle. Simple override this and do what you need to do.
onResume()