MAD11877 / mad21-practical-4---recyclerview-jordanchoi

mad21-practical-4---recyclerview-jordanchoi created by GitHub Classroom
0 stars 0 forks source link

MAD Practical 6 - Storage

Continuing from previous weeks, you might have observed that the values generated and changes made by users are not saved. This week, you will be adding persistant storage to your app.
Follow the instructions below to complete your app.

  1. Create your db handler class extending SQLiteOpenHelper. This class will create a new database upon initialization. There is a User table, whose structure follows the User class diagram. 20 User data are generated and inserted into the table. The name, description and value of followed are randomized, the value of id is an auto-increment primary key.
user_cd p6_db
  1. Create a getUsers() function in your db handler. This function will returns all the user information from the database as a List.

    Modify your RecyclerView so that it is pre-populated with information from the database only.

  2. Create a updateUser() function in your db handler. This function will receive a User object and update the corresponding value in the database.

    Modify your MainActivity so that it calls this function to update the database every time the Follow/Unfollow button is clicked.

  3. If all the above have been modified successfully, changes made to the user profile will be saved persistently. Test your app to verify this behaviour.

  4. Remove the intent-filter for the MainActivity from the manifest. This will allow the user to launch your app via the ListActivity only.