Advertisement
Guest User

Untitled

a guest
Dec 12th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. package database;
  2.  
  3. import android.content.ContentValues;
  4. import android.content.Context;
  5. import android.database.sqlite.SQLiteDatabase;
  6. import android.database.sqlite.SQLiteOpenHelper;
  7. import android.provider.ContactsContract;
  8.  
  9. public class DatabaseHelper extends SQLiteOpenHelper implements DatabaseConstants
  10. {
  11.  
  12. private static DatabaseHelper helper;
  13.  
  14. public DatabaseHelper(Context context)
  15. {
  16. super(context, DATABASE_NAME, null, DATABASE_VERSION);
  17. }
  18.  
  19. public static DatabaseHelper getInstance(Context context)
  20. {
  21. if(helper == null)
  22. {
  23. synchronized (DatabaseHelper.class)
  24. {
  25. if(helper == null)
  26. {
  27. helper = new DatabaseHelper(context);
  28. }
  29. }
  30. }
  31. return helper;
  32. }
  33.  
  34. @Override
  35. public void onCreate(SQLiteDatabase db)
  36. {
  37. db.execSQL(CREATE_TABLE_FEEDBACK);
  38. }
  39.  
  40. @Override
  41. public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
  42. {
  43. db.execSQL(DROP_TABLE_FEEDBACK);
  44. onCreate(db);
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement