Class NotificationAdapter

java.lang.Object
android.widget.BaseAdapter
android.widget.ArrayAdapter<Notification>
com.example.iconic_raffleevent.NotificationAdapter
All Implemented Interfaces:
android.widget.Adapter, android.widget.Filterable, android.widget.ListAdapter, android.widget.SpinnerAdapter, android.widget.ThemedSpinnerAdapter

public class NotificationAdapter extends android.widget.ArrayAdapter<Notification>
Adapter class to bind a list of notifications to a ListView. This adapter is used to display individual notification messages in a custom list item layout.
  • Field Summary

    Fields inherited from interface android.widget.Adapter

    IGNORE_ITEM_VIEW_TYPE, NO_SELECTION
  • Constructor Summary

    Constructors
    Constructor
    Description
    NotificationAdapter(android.content.Context context, List<Notification> notificationList)
    Constructor for creating a new instance of NotificationAdapter.
  • Method Summary

    Modifier and Type
    Method
    Description
    android.view.View
    getView(int position, android.view.View convertView, android.view.ViewGroup parent)
    Gets a view for a single notification item in the ListView.

    Methods inherited from class android.widget.ArrayAdapter

    add, addAll, addAll, clear, createFromResource, getAutofillOptions, getContext, getCount, getDropDownView, getDropDownViewTheme, getFilter, getItem, getItemId, getPosition, insert, notifyDataSetChanged, remove, setDropDownViewResource, setDropDownViewTheme, setNotifyOnChange, sort

    Methods inherited from class android.widget.BaseAdapter

    areAllItemsEnabled, getItemViewType, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetInvalidated, registerDataSetObserver, setAutofillOptions, unregisterDataSetObserver

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface android.widget.Adapter

    getItemViewType, getViewTypeCount, hasStableIds, isEmpty, registerDataSetObserver, unregisterDataSetObserver
  • Constructor Details

    • NotificationAdapter

      public NotificationAdapter(android.content.Context context, List<Notification> notificationList)
      Constructor for creating a new instance of NotificationAdapter.
      Parameters:
      context - The context where the adapter is being created.
      notificationList - The list of notifications to be displayed in the ListView.
  • Method Details

    • getView

      public android.view.View getView(int position, android.view.View convertView, android.view.ViewGroup parent)
      Gets a view for a single notification item in the ListView. This method is called for each item in the ListView, inflating a custom layout for each notification.
      Specified by:
      getView in interface android.widget.Adapter
      Overrides:
      getView in class android.widget.ArrayAdapter<Notification>
      Parameters:
      position - The position of the item within the adapter's data set.
      convertView - The recycled view to reuse, if available.
      parent - The parent view group that this view will eventually be attached to.
      Returns:
      The view displaying the notification message.