Package com.example.cardiotracker
Class HealthDataAdapter
java.lang.Object
android.widget.BaseAdapter
android.widget.ArrayAdapter<HealthData>
com.example.cardiotracker.HealthDataAdapter
- All Implemented Interfaces:
- android.widget.Adapter,- android.widget.Filterable,- android.widget.ListAdapter,- android.widget.SpinnerAdapter,- android.widget.ThemedSpinnerAdapter
The HealthDataAdapter is a custom ArrayAdapter used to populate a ListView with HealthData objects.
 It handles the creation of the list item views and displays the health data information in the appropriate views.
- 
Field SummaryFields inherited from interface android.widget.AdapterIGNORE_ITEM_VIEW_TYPE, NO_SELECTION
- 
Constructor SummaryConstructorsConstructorDescriptionHealthDataAdapter(android.content.Context context, List<HealthData> dataList) Constructs a HealthDataAdapter with the given context and data list.
- 
Method SummaryModifier and TypeMethodDescriptionprivate StringformatTime(String time) Formats the given time string into the desired format.android.view.ViewgetView(int position, android.view.View convertView, android.view.ViewGroup parent) Gets a View that displays the data at the specified position in the data list.Methods inherited from class android.widget.ArrayAdapteradd, addAll, addAll, clear, createFromResource, getAutofillOptions, getContext, getCount, getDropDownView, getDropDownViewTheme, getFilter, getItem, getItemId, getPosition, insert, notifyDataSetChanged, remove, setDropDownViewResource, setDropDownViewTheme, setNotifyOnChange, sortMethods inherited from class android.widget.BaseAdapterareAllItemsEnabled, getItemViewType, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetInvalidated, registerDataSetObserver, setAutofillOptions, unregisterDataSetObserverMethods inherited from class java.lang.Objectclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface android.widget.AdaptergetItemViewType, getViewTypeCount, hasStableIds, isEmpty, registerDataSetObserver, unregisterDataSetObserver
- 
Constructor Details- 
HealthDataAdapterConstructs a HealthDataAdapter with the given context and data list.- Parameters:
- context- the context of the adapter
- dataList- the list of HealthData objects to be displayed
 
 
- 
- 
Method Details- 
getViewpublic android.view.View getView(int position, android.view.View convertView, android.view.ViewGroup parent) Gets a View that displays the data at the specified position in the data list.- Specified by:
- getViewin interface- android.widget.Adapter
- Overrides:
- getViewin class- android.widget.ArrayAdapter<HealthData>
- Parameters:
- position- the position of the item within the adapter's data set
- convertView- the old view to reuse, if possible
- parent- the parent ViewGroup containing the convertView
- Returns:
- the View corresponding to the data at the specified position
 
- 
formatTimeFormats the given time string into the desired format.- Parameters:
- time- the time string to be formatted
- Returns:
- the formatted time string
 
 
-