Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Only run this code when the app is first installed
- SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
- boolean isFirstRun = pref.getBoolean("FIRSTRUN", true);
- if (isFirstRun)
- {
- // insert information into the local databases using different db managers
- db1 = new LocalDbManager(this);
- db1.openLocsToWrite();
- db1.insertLocations();
- db1.close();
- db2 = new LocalDbManager(this);
- db2.openFoodToWrite();
- db2.insertFood();
- db2.close();
- db3 = new LocalDbManager(this);
- db3.openParkingToWrite();
- db3.insertPark();
- db3.close();
- // change the flag to false now that the app has been run more than once
- SharedPreferences.Editor editor = pref.edit();
- editor.putBoolean("FIRSTRUN", false);
- editor.commit();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement