1/41
Flashcards from Android Views lecture
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is a View in Android?
Every visible component on the screen, serving as the basic building block for UI components.
What does the View class do?
Represents the basic building block for user interface components and the base class for classes that provide interactive UI components such as buttons, checkboxes, and text entry fields
What are the key properties of a View?
A location (left, top coordinates), width, and height, measured in density-independent pixels (dp).
How are Views arranged in a window?
In a single component tree, specified in code or XML layout files.
What is a TextView?
A user interface element that displays text to the user, similar to a Label.
What are the options for layoutheight and layoutwidth in XML?
matchparent, wrapcontent, and exact values in dp.
What is an EditText?
A user interface element for entering and modifying text; a subclass of TextView.
What is the purpose of the inputType attribute in EditText?
Configures the keyboard type, acceptable characters, and appearance of the edit text.
What is an ImageView?
A View that displays image resources, like Bitmap or Drawable resources.
What does the setImageResource(int resId) method do?
Sets a drawable as the content of an ImageView.
What is the R class?
A class for accessing resources, including R.id, R.layout, R.drawable, R.array, R.string, R.color, and R.style.
What is a RadioGroup?
A class used to create a multiple-exclusion scope for a set of radio buttons. Checking one unchecks others in the same group.
What is a RadioButton?
A two-state button that can be either checked or unchecked, commonly used within a RadioGroup.
What is a CheckBox?
A two-state button that can be checked or unchecked, allowing users to select one or more options from a set.
What are key attributes for Chips?
android:checkable, android:text, app:chipIcon, app:checkedIcon, and app:closeIcon.
What does an Adapter object do?
Acts as a bridge between an AdapterView and the underlying data for that view, providing access to data items and responsible for creating a View for each item.
What are subclasses of AdapterView?
ListView, Spinner, and GridView.
What is an ArrayAdapter?
An adapter that provides views for an AdapterView, returning a view for each object in a data collection, commonly used with ListView or Spinner.
What is a Spinner?
A view that displays one item at a time and lets the user pick among them (drop-down), getting its items from an Adapter.
How does a Spinner handle item selection?
By implementing the OnItemSelectedListener interface and overriding the onItemSelected and onNothingSelected methods.
What is a ListView?
A vertically-scrollable collection of views, where each view is positioned immediately below the previous view in the list.
How does a ListView handle item clicks?
By implementing the OnItemClickListener interface, implementing the onItemClick method, and calling the setOnItemClickListener(this) method.
What is a RecyclerView?
A view for displaying a list or grid of data, optimizing performance by only processing and drawing visible items.
What are the required parts to implement a RecyclerView?
Data, a RecyclerView instance, an item layout, a layout manager, a view holder, and an adapter.
What are the steps for implementing a RecyclerView?
Add RecyclerView to layout, design each item's look/behavior, decide on data source, create item layout, create an Adapter class (extending RecyclerView.Adapter), define the view holder, arrange items with a LayoutManager.
What is the purpose of AndroidManifest.xml?
To register the activities in your app and define the Intent Filter
What does adding an activity to AndroidManifest.xml look like?
What is a launcher icon?
A graphic that represents your app to users, appearing in the list of installed apps and on the Home screen.
What are ways to share data between Android Activities?
Use Intent extras, store data persistently in external files or remote storage, create a subclass of Application, use a Singleton class, or define public static variables.
What are the primary pieces of information in an Intent?
Action (the general action to be performed) and Data (the data to operate on, expressed as a Uri).
How can Extra data be sent when starting another Activity?
Via public Intent putExtra (String name, Bundle value)
How can the value be retrieved with the key name?
String message = intent.getStringExtra(FirstActivity.EXTRA_MESSAGE)
What interfaces can be used to send the Class Type?
Serializable Interface or the Parcelable Interface (preferred)
When using Serialization method what interface must the calss type implement?
Serializable Interface
Which method is used to get the parcel object in the SecondActivity?
Use teh following method to get the parcel object in the SecondActivity: public T getParcelableExtra (String keyName)
What is the base class for maintaining the global application state?
Application Class
What is the subclass that can be created to extend the Application class?
Define a class to extend the Application class; see the coding example below
Add the attribute android:name=“ .GlobalData” under the
What is the centralize control that cannot be extended?
Singleton class
What is used to allow the client to get the instance?
public static synchronized GlobalData getInstance()
What is a Gradle Build Tool?
A fast, dependable, and adaptable open-source build automation tool with an elegant and extensible declarative build language.
Where can you extend Gradle?
To provide your own task types or even build models
What is used to represent the scope of a dependency?
Gradle represents the scope of a dependency with the help of a Configuration.