IT0079 - Laboratory Exercise 6.2
IT0079 - Laboratory Exercise 6.2
IT0079
(MOBILE APPLICATION DEVELOPMENT 1)
EXERCISE
6.2
Static Login Account
Section:
Professor:
I. PROGRAM OUTCOME/S (PO) ADDRESSED BY THE LABORATORY EXERCISE
Understand best practices and standards and their applications. [PO: m]
A dialog is a small window that prompts the user to make a decision or enter additional information. A dialog
does not fill the screen and is normally used for modal events that require users to take an action before they
can proceed.
2. Content area
3. Action buttons
Action buttons are typically Cancel and/or OK, with OK indicating the preferred or most likely action. However, if
the options consist of specific actions such as Close or Wait rather than a confirmation or cancellation of the
action described in the content, then all the buttons should be active verbs. Order actions following these rules:
• The dismissive action of a dialog is always on the left. Dismissive actions return to the user to the
previous state.
• The affirmative actions are on the right. Affirmative actions continue progress toward the user goal
that triggered the dialog.
Alerts
Alerts inform the user about a situation that requires their confirmation or acknowledgement before
proceeding. They differ slightly in appearance based upon the severity and impact of the message conveyed.
Creating Dialog
The Dialog class is the base class for dialogs, but you should avoid instantiating Dialog directly. Instead, use
one of the following subclasses:
AlertDialog A dialog that can show a title, up to three buttons, a list of selectable items, or a custom layout.
DatePickerDialog or TimePickerDialog A dialog with a pre-defined UI that allows the user to select a date or
time
These classes define the style and structure for your dialog, but you should use a DialogFragment as a container
for your dialog. The DialogFragment class provides all the controls you need to create your dialog and manage
its appearance, instead of calling methods on the Dialog object.
Toast
A toast provides simple feedback about an operation in a small popup. It only fills the amount of space
required for the message and the current activity remains visible and interactive. For example, navigating away
from an email before you send it triggers a "Draft saved" toast to let you know that you can continue editing later.
Toasts automatically disappear after a timeout.
Graphical Layout
xml Code
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<Button
android:id="@+id/btnShowLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="19dp"
android:layout_marginTop="17dp"
android:text="@string/login"
android:onClick="showLogin"
/>
</RelativeLayout>
Graphical Layout
xml Code
a. Create a context that will hold the main context of the program
b. Write the inner class defining the dialog fragment of the program as shown
below.
package com.example.androidappsix;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.Context;
import android.content.DialogInterface;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
context = this;
}
dialog is a small window that prompts the user to make a decision or enter additional information.
A dialog does not fill the screen and is normally used for modal events that require users to take
an action before they can proceed. Dialogs inform users about a task and can contain critical
information, require decisions, or involve multiple tasks.
To add action buttons like those in figure 2, call the setPositiveButton() and setNegativeButton()
methods:
The set...Button() methods require a title for the button (supplied by a string resource) and a
DialogInterface.OnClickListener that defines the action to take when the user presses the button.
There are three kinds of lists available with the AlertDialog APIs:
two actions - Dialogs should contain a maximum of two actions. If a single action is provided, it
must be an acknowledgement action.
Horton, J. (2018). Android Programming for Beginners: Build in-depth, full-featured Android 9 Pie
apps starting from zero programming experience, 2nd Edition. Packt Publishing
Franceschi, H. J. (2018). Android App Development 1st Edition.
Iversen, J., Eierman, M. (2018). Mobile App Development for iOS and Android, Edition 2.0. Prospect
Press, Inc.
Phillips, B., Stewart, C., Marsicano, K. (2017). Android Programming: The Big Nerd Ranch Guide
(3rd Edition) (Big Nerd Ranch Guides) 3rd Edition.
Dawn, G. (2017). Head First Android Development: A Brain-Friendly Guide. O' Reilly Media, Inc.
Drongelen, M., Dennis, A., Garabedian, R. (2017). Lean Mobile App Development: Apply Lean
startup methodologies to develop successful iOS and Android apps. Packt Publishing
Miller, C. (2016), Cross-platform Localization for Native Mobile Apps with Xamarin
Beer, Paula(2015), Hello app inventor: android programming for kids and the rest of us.
Deborah Gonzalez (2015), Managing Online Risk: Apps, Mobile, And Social Media Security
Online Sources:
http://www.developer.android.com
http://www.android.com
http://www.onefeu.instructure.com