我正在創建一個簡單的 android 應用程式,在編輯文本中使用登錄憑據作為用戶名和密碼。當用戶嘗試重新登錄時,如何在應用程式中保存上次輸入的用戶名和密碼。我該怎么處理。我是否必須將它們存盤在 android 應用程式中,或者它可以照顧我的 android. 任何幫助將不勝感激。
<EditText
android:id = "@ id/editText2"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:inputType = "textPassword" />
<EditText
android:id = "@ id/editText1"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
/>
uj5u.com熱心網友回復:
最簡單的方法是使用Shared Preferences。
但是存盤原始憑證并不安全。
uj5u.com熱心網友回復:
你可以用不同的方式做到這一點:
- 將資料存盤在本地共享首選項中。
- 再次在本地保存資料,但使用Room 等資料庫。
- 制作在線資料庫并使用改造或類似的東西連接到它。(當涉及到更大的專案時,這是一個不錯的選擇)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/331649.html
