public static void addDataToLocalDatabase( Context context, ArrayList<Users> usersArrayList, String table) { for (int i = 0; i < usersArrayList.size(); i++) { sQliteHandlerClass.addUser(usersArrayList.get(i), table); Log.d("DATABASE", "Table:" + table + "\n" + usersArrayList.get(i).toString()); } sQliteHandlerClass.close(); }
public static void updateLocalDatabase(String filename, String username) { ContentValues cv = new ContentValues(); cv.put( "personal_photo", filename); // These Fields should be your String values of actual column names SQLiteDatabase db = sQliteHandlerClass.getWritableDatabase(); db.update( sQliteHandlerClass.TABLE_FRIENDS, cv, "username " + "= " + "'" + username + "'", null); }
public static Users getUser(String username, String table) { Users tmp = null; try { tmp = sQliteHandlerClass.getUsers(username, table); } catch (NullPointerException e) { e.printStackTrace(); } return tmp; }
public static ArrayList<Users> getUsersFromLocalDatabase(Context context, String TABLE) { ArrayList<Users> arrayListToReturn = null; return arrayListToReturn = sQliteHandlerClass.getAllUsers(TABLE); }
public static boolean removeUser(String username) { return sQliteHandlerClass.removeUser(username); }