I am using SharedPreferences. The problem I have is when I press Back button to exit app it take me back to the Preferences screen.
How can I prevent it and just exit the app without visit this screen?
I have only one activity beside SharedPreferences.
Simply call
finish()in the Activity when you are done using it. This would kill your SharedPreference Activity and not return to it when you press the BackButton.Another way could be not to keep a history of the activity in the stack.
Also, you might want to try
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP)