Shaba Practical

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

PRACTICAL FOUR

1. Project Setup:
-We Create a new Android project in Android Studio. Then we Set up the necessary
development environment and dependencies.
2. User Interface Design:
- We Design the login screen layout using XML. Then Include EditText fields for username
and password input.
- We Add a Button for the login action, initially disabled.
3. XML Layout Design:
- In this Step we Define EditText widgets for username and password. Then we Set
attributes like IDs, hints, and input types.
- Create a Button for login with an initial state of "disabled."
4. Activity Class Creation:
- Create a new Java/Kotlin class for the login activity.
- Link the XML layout with the activity using `setContentView()`.
5. View Binding (Optional):
- We Implement view binding to efficiently access UI elements in your activity.
6. User Input Handling:
- We Implement logic to listen for changes in the username and password EditText fields.
- Use TextWatcher or LiveData to monitor text input changes.
7. Validation Logic:
- We Write code to validate the username and password inputs, to check if the username and
password meet your criteria (e.g., length, format, etc.).
- Enable the login button when validation criteria are met; otherwise, keep it disabled.
8. Login Button Click Handling:
- We Implement an `OnClickListener` for the login button.
- Inside the click listener, validate the username and password again.
- If validation passes, proceed with the login process (e.g., navigate to the main activity).
10. Testing:
- Test your login screen thoroughly with various test cases, including valid and invalid
inputs.
- Ensure that the login button is appropriately enabled or disabled based on validation.
PRACTICAL FIVE
1. Project Setup:
- We Create a new Android project in Android Studio. Then we Set up the necessary
development environment and dependencies.
- Create a database or choose an existing one for user data storage.
2. Database Design:
- We Design the database schema to store user information (e.g., username, password,
email).
- We also Choose a database technology (e.g., SQLite, MySQL, Firebase) and create the
necessary tables.
3. User Interface Design:
- Design the login and registration screens using XML layouts.
- Include EditText fields for username, password, and email on the registration screen.
- Add Buttons for login and registration.
4. XML Layout Design:
- We Define EditText widgets for input fields, set attributes like IDs, hints, and input types,
also Create Buttons for login and registration.
5. Activity Classes:
- We Create Java/Kotlin classes for the login and registration activities. Then we Link the
XML layouts with the activities using `setContentView()`.
6. View Binding (Optional):
- Implement view binding to efficiently access UI elements in your activities.
7. User Input Handling:
- We Implement logic to listen for changes in the input fields using TextWatcher or
LiveData, and validate user input for correctness (e.g., email format, password strength).
8. Database Connection:
- We Integrate database connectivity code to perform CRUD operations (Create, Read,
Update, Delete) for user accounts. Then we Establish connections to the database using
appropriate libraries or APIs.
9. Registration Logic:
- We Write code to handle user registration, Check if the username is unique, store user
information securely in the database, and also Provide feedback to the user (e.g., success or
error messages).
10. Login Logic:
- We Implement code to handle user login, Verify the username and password against
database records, grant access if credentials match, and also redirect the user to the app's
main functionality.
11. Security Considerations:
- We Hash and salt passwords before storing them in the database. Then Implement
security measures to protect against SQL injection and other vulnerabilities.
13. Testing:
- Test the login and registration processes thoroughly with various test cases, including
valid and invalid inputs.
- Ensure database interactions work as expected.

You might also like