I would like my application, when launched to check wether a username and password are saved in sharedPreferences. If it detects those credentials, a login page is shown, if it doesn't, a registration page is shown. After the user logs in to the app I would like for the entire app to close wether the device's back button is pushed or the apps exit button is pushed.
I have everything working besides the apps closing properly. I thought I coded it correctly but I didn't. How can I get the entire app to close when the exit and device back button are selected.
exit method:
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
finish();
}
});
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
arg0.cancel();
}
});
AlertDialog alert=builder.create();
alert.show();