Advertisement
colmulhall

Untitled

Apr 4th, 2014
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1.     // Only run this code when the app is first installed
  2.         SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
  3.         boolean isFirstRun = pref.getBoolean("FIRSTRUN", true);
  4.         if (isFirstRun)
  5.         {
  6.             // insert information into the local databases using different db managers
  7.             db1 = new LocalDbManager(this);
  8.             db1.openLocsToWrite();
  9.             db1.insertLocations();
  10.             db1.close();
  11.            
  12.             db2 = new LocalDbManager(this);
  13.             db2.openFoodToWrite();
  14.             db2.insertFood();
  15.             db2.close();
  16.            
  17.             db3 = new LocalDbManager(this);
  18.             db3.openParkingToWrite();
  19.             db3.insertPark();
  20.             db3.close();
  21.            
  22.             // change the flag to false now that the app has been run more than once
  23.             SharedPreferences.Editor editor = pref.edit();
  24.             editor.putBoolean("FIRSTRUN", false);
  25.             editor.commit();
  26.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement