I would like to have an activity which would consist of a close button i.e \'x\' at the right top corner closing the activity. Any examples on this will be very much helpful
Maybe an "Up" button is what you really need instead of a close button. From the official Android documentation: "Your app should make it easy for users to find their way back to the app's main screen. One simple way to do this is to provide an Up button on the app bar for all activities except the main one. "
Details are described here: https://developer.android.com/training/appbar/up-action.html