-
- All Implemented Interfaces:
-
android.widget.Adapter,android.widget.ListAdapter,android.widget.SpinnerAdapter,androidx.lifecycle.LifecycleObserver,com.firebase.ui.common.BaseChangeEventListener,com.firebase.ui.database.ChangeEventListener,com.firebase.ui.database.FirebaseAdapter
public abstract class FirebaseListAdapter<T> extends BaseAdapter implements FirebaseAdapter<T>
This class is a generic way of backing an Android android.widget.ListView with a Firebase location. It handles all of the child events at the given Firebase location. It marshals received data into the given class type.
See the READMEfor an in-depth tutorial on how to set up the FirebaseListAdapter.
-
-
Constructor Summary
Constructors Constructor Description FirebaseListAdapter(FirebaseListOptions<T> options)
-
Method Summary
Modifier and Type Method Description voidstartListening()Start listening for database changes and populate the adapter. voidstopListening()Stop listening for database changes and clear all items in the adapter. voidonChildChanged(@NonNull() ChangeEventType type, @NonNull() DataSnapshot snapshot, int newIndex, int oldIndex)voidonDataChanged()voidonError(@NonNull() DatabaseError error)ObservableSnapshotArray<T>getSnapshots()Returns the backing ObservableSnapshotArray used to populate this adapter. TgetItem(int position)DatabaseReferencegetRef(int position)Returns the reference at the specified position in this list. intgetCount()longgetItemId(int i)ViewgetView(int position, @Nullable() View convertView, @NonNull() ViewGroup parent)-
Methods inherited from class android.widget.BaseAdapter
areAllItemsEnabled, getAutofillOptions, getDropDownView, getItemViewType, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetChanged, notifyDataSetInvalidated, registerDataSetObserver, setAutofillOptions, unregisterDataSetObserver -
Methods inherited from class android.widget.Adapter
getCount, getItem, getItemId, getView -
Methods inherited from class com.firebase.ui.common.BaseChangeEventListener
onChildChanged, onDataChanged, onError -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
FirebaseListAdapter
FirebaseListAdapter(FirebaseListOptions<T> options)
-
-
Method Detail
-
startListening
void startListening()
Start listening for database changes and populate the adapter.
-
stopListening
void stopListening()
Stop listening for database changes and clear all items in the adapter.
-
onChildChanged
void onChildChanged(@NonNull() ChangeEventType type, @NonNull() DataSnapshot snapshot, int newIndex, int oldIndex)
-
onDataChanged
void onDataChanged()
-
getSnapshots
@NonNull() ObservableSnapshotArray<T> getSnapshots()
Returns the backing ObservableSnapshotArray used to populate this adapter.
-
getRef
@NonNull() DatabaseReference getRef(int position)
Returns the reference at the specified position in this list.
- Parameters:
position- index of the reference to return
-
getCount
int getCount()
-
getItemId
long getItemId(int i)
-
-
-
-