Home > other >  Good way for login aplication in Android Studio
Good way for login aplication in Android Studio

Time:10-19

I want to create a little Login application using Java in Android Studio. I have done this just with Java and have used a File on my own computer for it. That wont work with when the app is downloaded on other devices. at least that's what I think. I have used a file in the format of username:password, split it on ":" and then transferred it into a hash map. Can I have a "central" File where every new account gets added to? Or is there an other better way to do that? I have no clue on how to do that and can't find a solution on YouTube or google. I want to add: I don't want to have the best or most effective solution for it but the easiest. I am completely new to Android and kind of new to Java and programming in general. I just want something to write accounts to and read them out.

CodePudding user response:

I think you should read about sqllite. It`s a database made for android studio. Basically you save the username and the password into a file for each user and when you try to login, you will read all the username-password combinations to see if one matches. If one matches ,it's a login.

CodePudding user response:

I Agree with Cosmin but we have also some best practices for this Like you can use the room database instead of Sqlite. Also, you can use SharedPreferences for storing the Current User.

room reference : https://www.geeksforgeeks.org/how-to-perform-crud-operations-in-room-database-in-android/

shared preferences reference : https://www.tutlane.com/tutorial/android/android-shared-preferences-with-examples

  • Related