title: Run a piece of code only once when an application is installed
body: <p>I want to run a piece of code only once in my application and is when i run it for the first time (newly installed app). How could i do this, can anyone explain giving a piece of code.</p>
  
  <p>Actually, in my android project i want to create database and insert some values on the first run only. After that, that particular piece of code should not run again. How can i achieve this mechanism through <strong>SharedPreferences</strong> or <strong>Preferences</strong>.</p>
  
  <p>Sample code will be more helpful.</p>