title: overriding the onBackPressed() not responding
body: <p>I was working on an app similar to the ' Diaro ' app and the ' MyDiary ' app on android.</p>
  
  <p>The main activity in my app is the DiaryActivity which controls all other activities.  When the add button is pressed, a new activity is opened, the user enters data in an edit text field, on pressing the back button the item gets saved in the database and gets displayed in a list, (the list is a part of the main activity).</p>
  
  <p>NOW THE PROBLEM with the main activity is that, on pressing the back button, the application instead of shutting down, takes the control back to the main activity, only this time, the last entry made is not present, also it is only now if the back button is present again, the application shuts down. </p>
  
  <p>I thought the possible solution could be overriding the onBackPressed() function and writing finish() function in that, but that didn't work.</p>
  
  <p>The code for the activity is here.</p>
  
  <p><a href="http://pastebin.com/ugMdVsbW" rel="nofollow">http://pastebin.com/ugMdVsbW</a></p>