The launch counter in the lab is updated by:

  1. Reading the value only
  2. Using commit() twice
  3. Creating a new file each time
  4. Reading the old value, adding 1 and writing it back
Answer

D) Reading the old value, adding 1 and writing it back

Read–modify–write updates the stored number.

Computer Science MCQ · More Lab: SharedPreferences MCQs · Practise