The question and the answer is easy. Catch the back button and write finish() to close the application. But it may not work in some cases.
I faced with one of this cases and found a different approach. To use onBackPressed method you have to use Android 2.2 and higher. Hope this also helps to you.
public void onBackPressed()