Catch the back-button event as follows:
public void onBackPressed()
{
return;
}
Now create a flag so that your application does not close on first launch. Finally complete your activity by calling finish();in your activity.
For a quick show, Toasts use this:
Toast.makeText(this, "Press Back again to quit", Toast.LENGHT_SHORT).show();
, . , this.