skip to Main Content

I am creating a simple android app with login credentials as username and password in edit text.
How can i save last entered username and password in app , when user try to relogin. How should i handle it. Do i have to store them in android app or it can be taken care of my android. Any help would be highly appreciated.

<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"
/>

2

Answers


  1. The easiest way is using Shared Preferences.

    But it’s not safe to store credentials raw.

    Login or Signup to reply.
  2. You can do it in different ways:

    • store data in Shared Preferences locally.
    • save data locally again but with databases like Room.
    • make online database and connect to it with Retrofit or something
      like that. (this one is a good choice when it comes to bigger projects)
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search