title: Android : When app close do something
body: <p>I want when user close my app it update SQLite data then close app. I used <code>onPause()</code>, <code>onStop()</code> and <code>onDestroy()</code> method in different time on <strong>MainActivity</strong>. All methods work when app close.</p>
  
  <p><strong>But The problem is</strong>, <em><code>onStop()</code>, <code>onPause()</code> and <code>onDestroy()</code> are called when I change activity. But I don't want to do it when I change activity, only when I close my app.</em></p>
  
  <p>How I can do that?</p>
  
  <p>Thank you for your response.</p>