Hint
A short message displayed in UI elements, like text fields, to guide users.
They typically appear as greyed-out text providing clues about the expected input.
Toast
Provides a simple feedback about an operation in a small popup.
They are used to show short messages and do not interfere with user interaction
Context
This term refers to an object that provides access to application-specific resources and information.
getApplicationContext()
This method is a way to obtain the global application context in Android.
Snackbar
You can use this for alternatives if you want to include user actionable options, which provide a better app experience.
Works best if they are displayed inside of a CoordinatorLayout.
CoordinatorLayout
Allows the snackbar to enable behavior like swipe-to-dismiss, as well as automatically moving widgets.
AutoCompleteTextView
It is a versatile Android widget that enhances user input by providing autosuggestions or completions as users type.
It can filter suggestions based on user input, providing a more tailored list of options as the user types.
Improves user experience.
Reduces typing errors.
Accelerates data entry.
Importance of AutoComplete:
Implementating AutoComplete
It is straightforward
Works like a regular EditText but comes with a dropdown menu showing suggestions based on user input.
Suggestions
Provided through an adapter.
You can use ArrayAdapter for a simple list of suggestions or customize for more complex scenarios.
ArrayAdapter
Serves as a link between the UI Component and the Data Source.
It transforms data from the data sources into view items that may be shown in the UI Component.
.setThreshold()
Set the minimum number of characters to trigger suggestions
ListView
A ViewGroup that is used to display the list of items in multiple rows and contains an adapter that automatically inserts the items into the list.
The main purpose of the adapter is to fetch data from an array or database and insert each item that is placed into the list for the desired result.
AlertDialog
It is a pop-up interface that provides important information or prompts user interaction.
These pop-up interfaces act as a bridge between your application and its users, creating a seamless and interactive user experience
It serves to prevent accidental deletion of messages by confirming the user's intent before taking any action.
It provides a clear and concise prompt, enhancing user understanding and minimizing the risk of unintentional data loss.
setMessage("Your Message")
Sets the main message text in the alert dialog.
Provides clear and concise information to the user.
Syntax:
alertDialogBuilder.setMessage("Are you sure you want to say hello?")
setTitle(“Dialog Title”)
Sets the title of the alert dialog
Syntax:
alertDialogBuilder.setTitle("Enter Text")
.setPositiveButton(“Positive Button Text”, onClickListener)
Adds a positive button to the dialog with the specified text.
Handles the positive action
Syntax:
.setPositiveButton("Yes", new DialogInterface.OnClickListener(){}
.setNegativeButton(“Negative Button Text”, onClickListener)
Adds a negative button to the dialog with the specified text.
Handles the negative action
Syntax:
.setNegativeButton("No", new DialogInterface.OnClickListener(){}
.setCancelable(boolean)
Sets whether the dialog can be canceled using the back button or outside touch.
Use true for cancellable, false otherwise.
Syntax:
.setCancelable(false)
.show()
Displays the alert dialog to the user.
This method should be called after configuring all necessary properties.
Syntax:
.show();
Notification
It is a message that Android displays outside your app's UI to provide the user with reminders, communication from other people, or other timely information from your app.
Users can tap the notification to open your app or take an action directly from the notification.
Notication in its Basic and Compact Form
Also known as collapsed form
Displays an icon, a title, and a small amount of text content
Small Icon
App name
Time stamp
Large Icon
Title
Text
Notification Anatomy
Small Icon
Required
set using setSmallIcon()
App name
Provided by the system
Time stamp
Also provided by the system; but
Can override it using setWhen(); or
Hide it using setShowWhen(false)
Large Icon
Optional;
Usually used only for contact photos.
Don't use it for your app icon.
Set using setLargeIcon()
Title
Also optional;
Set using setContentTitle()
Text
Also optional;
Set using setContentText()
PendingIntent
To make your notification clickable and open your application, you need to add a _____________ to your NotificationCompat.Builder.
addAction
To add an action button to your notification, you can use the _________ method of the NotificationCompat.Builder class.
Splash Screen
It is a screen that appears when you launch an app, typically displaying the app's logo or branding for a few seconds before transitioning to the main content.
new Handler().postDelayed
Creates a new instance of the Handler class and calls its ‘postDelayed’ method that is responsible for making the code to be run after the specified amount of time elapses.
(new Runnable()
Represents a task that can be executed
public void run(){
This is the run method of the Runnable interface
It contains the code that will be executed after the specified delay.
CardView
It is a UI component in Android that serves as a container for organizing and displaying information in a card-like structure.
Rounded Corners (Ex. app:cardCornerRadius = “dp”)
Elevation (Ex: app:cardElevation = “dp”)
Features of CardView:
RecyclerView
It makes it easy to efficiently display large sets of data.
You supply the data and define how each item looks, and the
RecyclerView library dynamically creates the elements when they're needed.
It's an improvement over ListView, offering better performance and flexibility.
Constructor
It is a special method that is automatically called when an object of a class is created.
Its primary purpose is to initialize the object's state, setting initial values for the object's attributes or performing any necessary setup.
It is used to set initial values for object attributes or to perform any setup steps required when an object is created.
Getters
It is used to retrieve the value of a private field.
It is often named with the prefix "get" followed by the name of the attribute.
It allows you to read the value of a private field.
It is used in Java to retrieve the values of private fields from a class
RecyclerViewAdapter
Manages the list of planets and binds data to the views.
myViewHolder
Holds references to the views in each item layout.
Context
Used to inflate the layout and access resources.
onCreateViewHolder
Inflates the item
onBindViewHolder
Binds data to the views.
getItemCount
Returns the number of items in the list.
Interface
It is a contract between any class that implements it.
Refers to a programming construct that defines a contract for the methods that a class must implement.
It is used to achieve abstraction and provide a way for classes to interact with each other without exposing their internal details.
In the context of Android development, these are commonly used for implementing event listeners, callbacks, and other communication patterns between different components.
@Override
public void onItemClick(int position){
//** Code
}
This method will be added after you click Implement Methods
void onItemClick(int position);
Perform a few checks if the recycleView Interface is not null. And after knowing that the recyclerView is not null, we will grab the position from our adapter because it is needed in our interface method which is the ____