You are now on day 8 of 100 days android app development challenge for beginners. I hope you had fun with the previous challenges.
New update about this android challenge
I have received lots of feedback from participants and many people. The general consensus was that the initial challenges are very simple and easy. Beside, participants want something more challenging which will also look like a project.
So I will give it a try from this challenge. If you feel that any of the challenges is too hard for a beginner, kindly contact me or leave a message in the comment section.
So lets proceed with today’s challenge.
Aim of this Challenge
To learn how to implement Login and Logout in android using Shared Preferences.
Task Requirements for this Challenge
1. Create a launch or intro Activity A
2. Add two EditText (Username and Password) and a Button widgets in Activity A layout file.
3. When the Button View on Activity A is clicked,
I. Check that the username and password fields are not empty
ii If the are empty instruct the user to fill in these fields
iii, If the fields are already filled validate the username and password with the username and password you stored in a Shared Preference.
4. If the username and password match then send the user to a new Activity B
5. If there is no match, stay in Activity A and notify the user of incorrect login details
6. If a user is login, display the username with welcome in Activity B and a Logout Button
7. If a user click on the Logout Button it will redirect the User to Activity A with all the EditText empty.
Note
You must store a hand coded username and password when the app initially loads.
Task Screen-shot
What happens when you are done?
Like I said in the instruction, you can host your solution on Github, bucket or Pastebin and share the link in the comment section with everybody.
I usually go through each link and let the owner knows where to improve or modify if need be.
What if I have a question during a challenge?
We are all here to learn and improve. Feel free to ask questions that are related to the task in question. There are many people out there that will help your out.
Why should I take part in this challenge?
If you want to improve and get better with your android development knowledge and skill as a beginner this might be a right decision for you.
This will also give you the opportunity to connect to like-mind android developers around the world.
Now is time to start
If you are high in spirit and motivated then hit the start button of your android IDE.
Here with find the answer project in git hub. I referred your Shared Preference tutorial and used Object to String conversion in my project. I learned lot from that tutorial. Thanks lot. If possible add a tutorial of Android and SLIM (There is already a one with php and mysql. But it is too complicated. If possible tone down it or add a simple one with only the basics with complete code)
https://github.com/hkadira/D8AndroidChallenge
Henry, Below is my Day 8 Challenge Link.
https://github.com/pblnrao/Android100DaysExcercise/blob/master/Day8Assignment.rar
Here’s the link for the solution:
https://github.com/m-abhi/SharedPreferencesDemo
here is my link for the solution
https://github.com/ilatyphi95/SimpleLoginPage