Currently I have an application that has the following code. If the user doesnt save the project before clicking the back button, I provide a dialog box to see if they want to save it prior to exiting the activity.
case android.R.id.home:
if(!didWeSave){
SHOW THE DIALOG BOX WITH OPTIONS
} else {
NavUtils.navigateUpFromSameTask(this);
}
return true;
Right now, it only works properly when the user hits on the back arrow from within the application. However, it does not work when I hit the back button on the physical device. How would this be fixed?
Thanks