Я создаю приложение для хранения данных в файле общих настроек. Проблема в том, что я хочу знать, как я могу добавить новую строку (карту) в файл sharedpref, но не редактировать ту же карту или обновлять те же ключи карты , пара значений
Когда я проверил файл sharedpref в его местоположении после добавления новых данных, я обнаружил, что обновляется та же карта, и не добавил новую карту (или строку)
MainActivity .kt
//start sharedpreference to save data
val sharedPrefFile = "goldinvesto" //filename to save
val collectdata:SharedPreferences = this.getSharedPreferences(sharedPrefFile, Context.MODE_PRIVATE)
val editor:SharedPreferences.Editor=collectdata.edit()
editor.putString("start_date",save_date)
editor.putString("amount",save_amount_txt)
editor.putString("currency",spin.selectedItem.toString())
editor.putString("karat",spin2.selectedItem.toString())
editor.putString("enter_price",save_enter_price)
editor.apply()
editor.commit()
Расположение файла общего доступа: ![enter image description here](https://i.stack.imgur.com/yfNi5.png)